12-29-2011, 03:27 AM
(This post was last modified: 12-30-2011, 12:39 AM by AceInfinity.)
Here's my demo for you.
What we're doing here is defining a byte array from the resource named "file" as an executable i've added as a project resource, and writing those bytes to a file i'm creating in it's own path with the myfile.exe name.
Very very easy there buddy. You can also look into ByteReader and ByteWriter in the System.IO namespace if you want.
Now to run this:
This won't work:
Because Process.Start() doesn't take a byte array as input which is what my.resources.filename really is, it's not a string, it's a byte array.
Code:
Dim resFile As Byte() = My.Resources.file
Dim WritePath as string = "MyFolderPathHere\myfile.exe"
Dim fstream As New FileStream(WritePath, FileMode.Append)
fstream.Write(resFile, 0, resFile .Length)
fstream.Close()
What we're doing here is defining a byte array from the resource named "file" as an executable i've added as a project resource, and writing those bytes to a file i'm creating in it's own path with the myfile.exe name.
Very very easy there buddy. You can also look into ByteReader and ByteWriter in the System.IO namespace if you want.
Now to run this:
Code:
Process.Start(WritePath)
This won't work:
Code:
Process.start(my.resources.filename)
Because Process.Start() doesn't take a byte array as input which is what my.resources.filename really is, it's not a string, it's a byte array.