• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 164
  • Last Modified:

Ok, Windows is shutting down.... how?

Once you press shutdown and select "Shutdown" or "Reboot" how can my application tell which was chosen?  If the system is rebooting I want to ask a quistion and if it is shutting down or logging off I want to bypass the question.

I've asked this on a few board with a "No Idea!" responce from most......   PLEASE Help!!!!
0
DaneJones
Asked:
DaneJones
1 Solution
 
idcanadaCommented:
Put the following in your form unload event.

If UnloadMode =2  Then
' WinTel is Shutting Down
Msgbox "This is your Question"
Cancel = True
Else
' ???
' What ever it is
End if

0
 
DaneJonesAuthor Commented:
This gets triggered when the app is getting closed by either by Shutdown, reboot, log off, or restart in Dos mode.  I want to know how to trigger it ONLY when the system is being rebooted. Not Any of the other options in the shut down menu.
0
 
schildCommented:
You can't know it, becuase when you ask for it, the system send "normal" close request message, your program can never know where it asked before rebooting or restarting, in both cases it send the standard message of close request.
The same request messages are send by the tak list application as well

Schild
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
DaneJonesAuthor Commented:
I FOUND IT!!!!
When the system shutsdown it saves the value from the shutdown menu in the registry at.....

[HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer]
"Shutdown Setting"=dword:00000001


0
 
DaneJonesAuthor Commented:
Sorry Peps I'm going to with draw my question unless anyone can come up with a better solution than the one I've found...
0
 
disasmblerCommented:
I'm the one that Email you....
0
 
DaneJonesAuthor Commented:
Adjusted points to 355
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now