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!

Using ShellExecute on QueryUnload 1

Status
Not open for further replies.

Bubbler

IS-IT--Management
Dec 14, 2003
135
US
I am wondering if I am thinking about this correctly. What I am trying to do is have the exe file in the ShellExecute actually execute if the app is closed via a reboot, (not closed using the application but literaly hammering the reset button on the machine.
Will putting the ShellExecute in the QueryUnload event cause this to take place and fire myapp.exe in this code?


Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

If UnloadMode = vbAppWindows Then
ShellExecute hwnd, "open", App.Path & "\myapp.exe", vbNullString, vbNullString, SW_SHOWMAXIMIZED
End If

End Sub
 

What may happen is you are going to delay the shutdown of windows until you are CTRL+ALT+DELETED, and I as a user would not be to happy about having to baby sit a shutdown.

Perhaps a better solution is on startup make an entry in the registry under "Run Once". Search this site for more info. Then if you do not want to run at startup you could remove the entry.

Good Luck

 
Thanks vb5prgrmr, I never thought of that, I will give it a go!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top