Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to know if the NT WorkStation is locked ?

Posted on 2001-08-08
7
Medium Priority
?
303 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 800 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
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

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.

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Screencast - Getting to Know the Pipeline

885 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