Solved

How to know if the NT WorkStation is locked ?

Posted on 2001-08-08
7
287 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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