|
Is there a way to prevent the user from logging off from their Windows account while my application is running?
|
|
|
|
|
Is WM_QUERYENDSESSION of any help?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Yea thanks, I had forgotten about that mesage and it did the trick.
Thanks again
|
|
|
|
|
Method for XP or earlier is slightly different from Vista/Win7 from my experience.
For XP or earlier, return 0 for WM_QUERYENDSESSION and this should be enough.
For Vista/Win7, I haven't found a way to entirely stop logging off. But temporarily blocking logging off is possible. I would return 1 for WM_QUERYENDSESSION and register a blocking reason during WM_ENDSESSION, by calling ShutdownBlockReasonCreate. Then call ShutdownBlockReasonDestroy when your application is finished running.
You should obey the description mentioned in WM_ENDSESSION Message[^] and WM_QUERYENDSESSION[^] to make sure both user and Windows system are happy.
|
|
|
|
|
Are you paying for their computer?
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
He he, no but the PC is running an important control system that the normal user is not authorised to shut down. However, if the user logs off, it closes my application.
|
|
|
|