Using VB to open .exe's

Started by
6 comments, last by isiahil 19 years, 10 months ago
How do i use visual basic 6.0 to open .exe files?
I don't have to do nothing but live and die, everything else i choose to do- I don't know, but my dad says it alot
Advertisement
If you mean to just run an executable then you can use

Shell(Command As String)

for example

Shell("C:\WINDOWS\notepad.exe"

to open notepad
There is a matching API call that can make Shell() more powerful (ie. with the call if you shell("path\exampleworddocument.doc") it will open in word. By default the shell function only works on executables AFAIK).

- Jason Astle-Adams

No, it works with any registered file type.

GDNet+. It's only $5 a month. You know you want it.

If you mean how can you modify an .exe using visual basic, the answer is you can''t.
ShellExecute(...)?
quote:
No, it works with any registered file type.


Not without the accompanying Win32 API call.

Private Sub CmdShellTxt_Click()  shell("C:\testtextfile.txt") 'produces 'invalid proceedure call or argument' errorEnd SubPrivate Sub CmdShellExe_Click()  shell("C:\testexefile.exe") 'Runs textexefile.exeEnd Sub  


Try it. More info on the function here.

//EDIT: added MSDN link



[edited by - kazgoroth on June 2, 2004 3:08:27 AM]

- Jason Astle-Adams

quote:Original post by MaulingMonkey
If you mean how can you modify an .exe using visual basic, the answer is you can''t.


How the hell did you come to that conclusion? I''m really, truly, baffled. Seriously.

It''s _entirely_ possible to modify _any_ file using VB 6.0 Anyone who knows the language is aware of this. Perhaps, in the future, you should avoid making comments about subjects you know nothing about.

This topic is closed to new replies.

Advertisement