Solved

How to know if the NT WorkStation is locked ?

Posted on 2001-08-08
7
282 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 6

Expert Comment

by:MichaelS
Comment Utility
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
Comment Utility
0
 
LVL 5

Expert Comment

by:Netminder
Comment Utility
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
Comment Utility
Force/accepted by

Netminder
Community Support Moderator
Experts Exchange
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to Date and time Picker 32 95
TFS Branching 4 63
SQL to ElasticSearch Query 1 521
Alternative to visual sourcesafe 2 98
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now