Solved

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

Posted on 1998-09-21
7
159 Views
Last Modified: 2010-04-30
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
Comment
Question by:DaneJones
7 Comments
 
LVL 4

Expert Comment

by:idcanada
ID: 1435980
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
 

Author Comment

by:DaneJones
ID: 1435981
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
 
LVL 2

Expert Comment

by:schild
ID: 1435982
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:DaneJones
ID: 1435983
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
 

Author Comment

by:DaneJones
ID: 1435984
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
 

Accepted Solution

by:
disasmbler earned 350 total points
ID: 1435985
I'm the one that Email you....
0
 

Author Comment

by:DaneJones
ID: 1435986
Adjusted points to 355
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question