Page 1 of 1

Check if user Locked/Unlocked Windows from my Software

Posted: Thu Apr 20, 2017 11:40 pm
by hebert_j_vargas
Hi, as mentioned on the subject, I searched on msdn SessionSwitchReason.SessionLock, but I'm unable to understand how to implement on harbour+Fwh
Here:
https://msdn.microsoft.com/en-us/librar ... -snippet-1
and
https://msdn.microsoft.com/en-us/librar ... -snippet-1

Please help!

Re: Check if user Locked/Unlocked Windows from my Software

Posted: Sat Apr 22, 2017 5:38 pm
by hebert_j_vargas
+Up

Re: Check if user Locked/Unlocked Windows from my Software

Posted: Thu Apr 27, 2017 1:32 am
by hebert_j_vargas
Up!++

Re: Check if user Locked/Unlocked Windows from my Software

Posted: Fri Apr 28, 2017 6:53 pm
by James Bott
I don't know if this will work, but try this:

Code: Select all

Function isWindowsLocked()
    Local lLocked:=.f.
    if getForegroundWindow() == 0  // Screen saver or login screen is foreground
      lLocked:=.t.
    endif
Return lLocked

 
James

Re: Check if user Locked/Unlocked Windows from my Software

Posted: Sat Apr 29, 2017 11:39 pm
by hebert_j_vargas
James Bott wrote:I don't know if this will work, but try this:

Code: Select all

Function isWindowsLocked()
    Local lLocked:=.f.
    if getForegroundWindow() == 0  // Screen saver or login screen is foreground
      lLocked:=.t.
    endif
Return lLocked

 
James
Thank's James, It Worked Flawlessly!!!

Re: Check if user Locked/Unlocked Windows from my Software

Posted: Sat Apr 29, 2017 11:56 pm
by James Bott
Hebert,

Glad to hear it.

I am curious why you needed this? Maybe its something some of the rest of us might use too, if we knew what kind of a problem it solves.

James

Re: Check if user Locked/Unlocked Windows from my Software

Posted: Sun Apr 30, 2017 4:47 am
by nageswaragunupudi
Mr James
Wonderful idea :-)

Re: Check if user Locked/Unlocked Windows from my Software

Posted: Mon May 01, 2017 12:16 am
by hebert_j_vargas
James Bott wrote:Hebert,

Glad to hear it.

I am curious why you needed this? Maybe its something some of the rest of us might use too, if we knew what kind of a problem it solves.

James
James I have an application receving messages from other users (not a chat), if the user leave the computer alone, after a while in idle mode Windows will get locked automaticaly and I need to inform other user's that this user is not in from of the desk, so request or messages can be send to other user or operator, that's the reason I need to check if Windows is Locked, and many thank's for you interest.

Re: Check if user Locked/Unlocked Windows from my Software

Posted: Mon May 01, 2017 12:36 pm
by James Bott
Hebert,

Well, that is a very good use. Congrats on thinking of how to accomplish it!

I'm going to record that in my bag of tricks.

Feel free to make some more contributions here when you come up with ideas like this.

James

Re: Check if user Locked/Unlocked Windows from my Software

Posted: Tue May 02, 2017 12:48 am
by hebert_j_vargas
James Bott wrote:Hebert,

Well, that is a very good use. Congrats on thinking of how to accomplish it!

I'm going to record that in my bag of tricks.

Feel free to make some more contributions here when you come up with ideas like this.

James
Bag of tricks, hum! I'll take this idea as well, I'm eager to contribute and many thank's James.