hi i really need some code that will allow me to open any type of exe from my visual basic program, i am trying to creat a portable app program for my usb memory stick, so that when i insert my usb memory stick it will come up with a menu and you can elect certain programs and that is where i need you help i need some code that will open a .exe through my program. thanks in advance
VB 6 problem executing a .exe program via a visual basic app
Exec method:
http://msdn2.microsoft.com/en-us/library/aa300836(VS.71).aspx
http://msdn2.microsoft.com/en-us/library/aa300836(VS.71).aspx
Have you tries using Shell. I use it sometimes to open other EXEs on my PC like calling WORD or EXCEL for instance.
what is shell? i could give it ago if i can find out how to do it?
Shell Function
Shell(pathname[, windowstyle])
Runs the executable program specified by the pathname argument and returns a Variant of subtype Double that represents the program's task ID. If Shell is unsuccessful, it returns zero. The optional windowstyle argument determines the style of the window in which the shelled program runs.
Shell(pathname[, windowstyle])
Runs the executable program specified by the pathname argument and returns a Variant of subtype Double that represents the program's task ID. If Shell is unsuccessful, it returns zero. The optional windowstyle argument determines the style of the window in which the shelled program runs.
| andy26 wrote: |
| hi i really need some code that will allow me to open any type of exe from my visual basic program, i am trying to creat a portable app program for my usb memory stick, so that when i insert my usb memory stick it will come up with a menu and you can elect certain programs and that is where i need you help i need some code that will open a .exe through my program. thanks in advance |
Try:
| Code: |
| retval = shell ("c:\windows\calc.exe",1) |
replace c:\windows\calc.exe with the file (with its location) you want to open.
If you want to open a directory, try:
| Code: |
| retval = shell ("explorer c:\windows\",1) |
