Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to know if the NT WorkStation is locked ?

Posted on 2001-08-08
7
Medium Priority
?
298 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
[X]
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
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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
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

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.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and 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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

704 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