Results 1 to 5 of 5

Thread: How can i open a exe file in my resoure

  1. #1

    Thread Starter
    Fanatic Member manhit45's Avatar
    Join Date
    May 2009
    Location
    Ha noi - Viet Nam
    Posts
    826

    How can i open a exe file in my resoure

    I have a exe file in my resoure. How can i open it.(execute it)?
    --***----------***-----

    If i help you please rate me.

    Working with Excel * Working with String * Working with Database * Working with array *

    K51 ĐH BÁCH KHOA HÀ NỘI - Khoa CNTT pro.

  2. #2
    Hyperactive Member Philly0494's Avatar
    Join Date
    Apr 2008
    Posts
    485

    Re: How can i open a exe file in my resoure

    Code:
            Dim path As String = Application.StartupPath & "\temp.exe"
            IO.File.WriteAllBytes(path, My.Resources.TheResourceFile)
            Process.Start(path)
    and then just delete the file when you're finished executing it (if you want)

  3. #3

    Thread Starter
    Fanatic Member manhit45's Avatar
    Join Date
    May 2009
    Location
    Ha noi - Viet Nam
    Posts
    826

    Re: How can i open a exe file in my resoure

    Quote Originally Posted by Philly0494 View Post
    Code:
            Dim path As String = Application.StartupPath & "\temp.exe"
            IO.File.WriteAllBytes(path, My.Resources.TheResourceFile)
            Process.Start(path)
    and then just delete the file when you're finished executing it (if you want)
    Thanks, i tried your way but it may be quite slowly,i thinks the reason is "writeallbytes" to new path , is there other way more quickly open that exe file ?
    --***----------***-----

    If i help you please rate me.

    Working with Excel * Working with String * Working with Database * Working with array *

    K51 ĐH BÁCH KHOA HÀ NỘI - Khoa CNTT pro.

  4. #4
    Addicted Member garyjohn_2000's Avatar
    Join Date
    Apr 2005
    Location
    Timbaland
    Posts
    243

    Re: How can i open a exe file in my resoure

    Write it to a MemoryStream instead...beware that if the size of the executable exceeds available memory, it might not be a nice idea after all. -.-


    Anyone who has never made a mistake has never tried anything new. - Einstein
    Peace!

  5. #5
    Hyperactive Member Philly0494's Avatar
    Join Date
    Apr 2008
    Posts
    485

    Re: How can i open a exe file in my resoure

    Quote Originally Posted by garyjohn_2000 View Post
    Write it to a MemoryStream instead...beware that if the size of the executable exceeds available memory, it might not be a nice idea after all. -.-
    I'm curious to see how this would be done, does anybody have an example of someone launching an executable into memory without writing it to its own file first?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width