- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Um, I deem Windows security APIs as a big black hole...
Alittle Googling, however, reveals this list -- the second link, for one, contains a code sample.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks to you both. I have the codeworking now for the most part and will share it here when finished.
Message Edited by frieler on 02-25-2004 08:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The attached code is a simple "Session Disposition" utility.
I have kept the functionality of this sample to a minimum and hope that the programming style is clear enough.
When one of my remote processes has ended, I execute this program to cleanup after myself. It can "LogOff", "ShutDown", "PowerOff" or "ReBoot", controlled by a command line string, i.e.,
C:> Dispose LogOff
Although this code only required afew calls to Win32, I agree with Jugoslav.The documentation isn't sufficiently clear or consistent, and without the code examples I could not have even gotten this simple utility working.
Thanks again to Jugoslav and Alan!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Next issue.........
The code functions well, but only if the user session is active. If a screen saver has activated and requires a password, the code fails. This means that I need to interact with the screen-saver and it's security hooks, or find some other means.
Any ideas or suggestions?
Thanks, Cliff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I assume you want to shutdown the computer after a long number crunching?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jugoslav,
It appears that
SystemParametersInfo -> SPI_SETSCREENSAVEACTIVE
controls whether or not the screensaver (and locking mechanism) will activate. While disabling this would solve the problem for installations with good physical security, in my environment I don't want that (and don't have the authorization).
Your suggestion has still been of great value, because while reading about SystemParametersInfo, I found the function InitiateSystemShutDown. It appears to allow system shutdown and reboot even if the workstation is locked.It still requires the SE_ShutDown_Name privilege be enabled, so the previous answers in this thread will also be used. The net result is that I can do everything I wanted, except simply logging off a locked workstation. Since the result of a reboot is the same login screen presented tothe next user, I anticipate little real difference.
I'll post the resulting code when I have it working.
Thanks, Cliff
Message Edited by frieler on 03-03-2004 04:02 PM

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page