ok, but msn does it very very very well, there's certainly a way... Is there
a way to know the state of the computer, locked/unlocked. It does not have
to be an event. Only a function that returns locked/not locked. maybe via
the user account?
thanks
ThunderMusic
I just tought about it... maybe a message in the wndproc?
> ok, but msn does it very very very well, there's certainly a way... Is
> there a way to know the state of the computer, locked/unlocked. It does
[quoted text clipped - 26 lines]
>> "At times one remains faithful to a cause only because its opponents do
>> not cease to be insipid." (c) Friedrich Nietzsche
John Brown - 15 Sep 2006 18:37 GMT
See the blurb right after the first example in the link below. There may
very well be a more official API function for checking it, but not likely
given what this says (if there were they would have almost certainly pointed
you there given that this is the official source)
http://windowssdk.msdn.microsoft.com/en-us/library/ms723150.aspx
> ok, but msn does it very very very well, there's certainly a way... Is
> there a way to know the state of the computer, locked/unlocked.
As Michael and John both posted, there IS a way. Test to see if your window
is visible (if it's not, and you haven't specifically made it not visible,
then the session is locked). Of course, you do need a window for that to
work.
> It does not have to be an event. Only a function that returns locked/not
> locked. maybe via the user account?
Also, see the SessionSwitch SystemEvent. It provides access to the
WM_WTSSESSION_CHANGE window message in .NET. As long as your program is
running, you can use that message to track when session changes occur
(including locking and unlocking).
By the way, I'd disagree that MSN does this "very well". I've seen it get
confused plenty of times. :)
Pete
ThunderMusic - 15 Sep 2006 19:23 GMT
I've found a solution, tought maybe it's not the best way, it does the trick
pretty well :
http://www.thescripts.com/forum/thread225183.html
thanks to all
ThunderMusic
>> ok, but msn does it very very very well, there's certainly a way... Is
>> there a way to know the state of the computer, locked/unlocked.
[quoted text clipped - 16 lines]
>
> Pete
John Brown - 15 Sep 2006 19:34 GMT
> I've found a solution, tought maybe it's not the best way, it does the
> trick pretty well :
I recommend you investigate this thoroughly. People often apply esoteric
ways of doing things but unless the techniques are officially sanctioned by
MSFT, you're asking for trouble (don't be surprised if it breaks one day
IOW).
Sgt.Sausage - 16 Sep 2006 00:45 GMT
>> I've found a solution, tought maybe it's not the best way, it does the
>> trick pretty well :
[quoted text clipped - 3 lines]
> by MSFT, you're asking for trouble (don't be surprised if it breaks one
> day IOW).
Also consider something that works fine in your environment, but
not someone else's. Consider what happens when, say, running
under Terminal Services, Citrix, et.al.
I've been burned this way many, many times -- I've since learned
my lesson.
Later ...
Sarge
Peter Duniho - 15 Sep 2006 23:27 GMT
> I've found a solution,
You mean you found *another* solution. Two different methods had already
been posted to this thread.
> tought maybe it's not the best way, it does the trick pretty well :
>
> http://www.thescripts.com/forum/thread225183.html
I think it's a pretty good bet that the other solution you found is not the
best way, and in fact is unlikely to be better than the methods already
given in this thread.
Pete