Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with coding
#1
Help me please to do this in vb.net
1.How do i copy my resources(which is an .exe) to a specific directory and run it.

2.How can i run an .exe file or .rar which i imported into the resources of my project by pressing button .

I tried the following codes but wasnt successful.

Process.start(my.resources.filename)

Shell(my.resources.filename)

Do help me out
Reply
#2
Here's my demo for you.

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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Coding-Central.net - Coding, cracking and webmastering. w00pz 5 2,036 09-02-2011, 01:43 PM
Last Post: AceInfinity
  Help Coding A Downloader? Fragma 9 2,846 08-25-2011, 06:10 PM
Last Post: LiveModz
  .Net Coding Challenge #5 iCrack 18 4,830 05-21-2011, 12:49 AM
Last Post: thanasis2028
  [TUT]Improve your Coding[VB] ThePrinCe 10 1,479 05-07-2011, 06:40 PM
Last Post: Inventor
  .Net Coding Challenge #3 Resistance 22 6,333 05-05-2011, 03:38 PM
Last Post: AceInfinity

Forum Jump:


Users browsing this thread: 1 Guest(s)