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!

Restarting Program

Status
Not open for further replies.

Cubby1

Programmer
May 24, 2004
5
US
I would like to issue a command from within a VB6 program by which I can restart the program, and thereby have all of my variables reinitialized, and the original program ended.

There was a command in Quickbasic that permitted this. I think it was the shell command.

Any ideas?

Cubby1
 
dim retval as variant

retval = shell("c:\YourAppPath\YourApp.exe", vbNormalFocus)
END



You could put the above code in a subroutine and call it when you want to restart your application.

Here is a list of parms to use with shell:

vbHide 0 Window is hidden and focus is passed to the hidden window.
vbNormalFocus 1 Window has focus and is restored to its original size and position.
vbMinimizedFocus 2 Window is displayed as an icon with focus.
vbMaximizedFocus 3 Window is maximized with focus.
vbNormalNoFocus 4 Window is restored to its most recent size and position. The currently active window remains active.
vbMinimizedNoFocus 6 Window is displayed as an icon. The currently active window remains active.


Thank you for all your help

Tom
 
Just use a subroutine to initialize all the variables, after unloading all forms. (call it on startup, so that it points to the first form.) When you want to restart, call the sub again.

-David
2006 Microsoft Valued Professional (MVP)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top