Check if user Locked/Unlocked Windows from my Software

Post Reply
User avatar
hebert_j_vargas
Posts: 94
Joined: Thu Aug 02, 2012 3:21 pm

Check if user Locked/Unlocked Windows from my Software

Post 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!
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)
FiveWin Version: FWHX 15.01
BCC 5.8.2
User avatar
hebert_j_vargas
Posts: 94
Joined: Thu Aug 02, 2012 3:21 pm

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

Post by hebert_j_vargas »

+Up
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)
FiveWin Version: FWHX 15.01
BCC 5.8.2
User avatar
hebert_j_vargas
Posts: 94
Joined: Thu Aug 02, 2012 3:21 pm

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

Post by hebert_j_vargas »

Up!++
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)
FiveWin Version: FWHX 15.01
BCC 5.8.2
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

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

Post 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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
hebert_j_vargas
Posts: 94
Joined: Thu Aug 02, 2012 3:21 pm

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

Post 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!!!
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)
FiveWin Version: FWHX 15.01
BCC 5.8.2
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

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

Post 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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post by nageswaragunupudi »

Mr James
Wonderful idea :-)
Regards

G. N. Rao.
Hyderabad, India
User avatar
hebert_j_vargas
Posts: 94
Joined: Thu Aug 02, 2012 3:21 pm

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

Post 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.
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)
FiveWin Version: FWHX 15.01
BCC 5.8.2
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

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

Post 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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
hebert_j_vargas
Posts: 94
Joined: Thu Aug 02, 2012 3:21 pm

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

Post 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.
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)
FiveWin Version: FWHX 15.01
BCC 5.8.2
Post Reply