Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to know if the NT WorkStation is locked ?

Posted on 2001-08-08
7
289 Views
Last Modified: 2013-12-03
I'm programming in C++.

I want to know if the NT WorkStation where my program is running is locked, so I can start a batch process.

I couldn't find any function that informs about us, so I guess that I have to query the registry or something.

Thanks.
0
Comment
Question by:pgiusto
7 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 6364421
If it is enough to know whether a screensaver is running, you could use

BOOL bRunning;
SystemParametersInfo ( SPI_GETSCREENSAVERRUNNING, 0, &bRunning, 0);

if ( bRunning) {
// is running
}
0
 

Author Comment

by:pgiusto
ID: 6364443
No, because we want to run the batch process when the user goes for lunch and the user MUST lock the workstation when he goes for lunch. The screen saver can run at other times.
0
 
LVL 6

Accepted Solution

by:
MichaelS earned 200 total points
ID: 6364768
Call OpenInputDesktop and if it returns handle to winlogon desktop than station is locked. The only problem will be is that if it's locked and screen saver is running than you get handle to screen saver desktop.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 6

Expert Comment

by:MichaelS
ID: 6364800
Or maybe you can open winlogon desktop and get active window from it and check what is it.
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6728261
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6775000
There has been no activity in this question in quite some time, and it looks like it has been abandoned. As part of our ongoing mission to clean up the topic areas, a Moderator will finalize this question within the next seven (7) days. At that time, either I or one of the other Moderators will force/accept the comment of MichaelS.

DO NOT ACCEPT THIS COMMENT AS AN ANSWER. If you have further comments on this question or the recommendation, please leave them here.

Netminder
Community Support Moderator
Experts Exchange
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6793131
Force/accepted by

Netminder
Community Support Moderator
Experts Exchange
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 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