Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have a 64 Bit .Net Application which is a Windows Form. The UI has a Live Video display which shows every Frame from a USB Camera using a delegate eventhandler. Frames are sent to this UI at 60 frames /sec. We have a need to stop the Live update whenever Windows Locks out due to the screen saver settings.

Code is all in C#.

We do know that the SystemEvents.SessionLock/Unlock does the trick for us. OR we could also use the WM_WTSSession_CHANGE through the WTSRegisterSessionNotification API's. Either way it is supposed to do the same work of letting the UI know that Windows has Locked or Unlocked.

All good so far.

The issue is when the Live Video is being updated, the SessionChange Events never gets to the WndProc() method or the SystemEvents SessionSwitch eventhandler. If I stop the Frame updates, then the events work perfectly fine. Yes the Frames being updated are on the GUI Thread using the InvokeRequired checks.

Result is the App crashes when Windows Locks out, because we didn't process the events in 5secs(MS recommendation).

Any ideas on how we can look into these session events before Frame updates? or on how do we solve this so the UI can process the Session events?

Your suggestions are much Appreciated.

What I have tried:

I have tried many options of getting it to process the events with some luck however its very inconsistent.

This is a kind of threading issue where the Frames updating is not allowing the Session events to be processed.

Update: If I force a lock(click Ctrl+Alt+Del) and log back in the Session Events are received. Just does not happen on Screen saver Lock.
Posted
Updated 27-Jul-22 22:48pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900