Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to start a program

Status
Not open for further replies.

erixire

Technical User
Jun 4, 2002
72
CA
Hi,

I'm totally new to this language. I searched a lot on the internet without result for my question. How do you start another program (for example: a DOS shell) like if I was in the MSDOS shell. For example, I want to be able to open a Dos shell when I click a button, so I want to do:

cmd.exe

How do I can do such a thing?

Thanks
 
One way is to use the "Shell" command, like :

Shell "Notepad.exe"
 
I've found the shell command in VB6 isn't the most stable of creatures. But in the matter of simply opening a program (especially DOS) you shouldn't have a problem. There is an API method that works (Search forum for 'API Shell') but in the case of your example IFRs' method should work fine. As a note, try using a variable set, it may make it more stable, and always use the full path

i.e (for COMMAND.COM)

================
Private Sub cmdShellDos_click()

'Declare Variable
Dim ShellCommand As String

'Set ShellCommand Variable
ShellCommand = "C:\WINDOWS\COMMAND\COMMAND.COM"

'Initialise Shell
Shell ShellCommand

End Sub
======================

Additional Thoughts,

¥oshi

-------------------------
"There is No Spoon.."
-------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top