locked
How to get handle for use in wtsregistrationsessionnotification RRS feed

  • Question

  • I have tried using wtsregistrationsessionnotification to register that I want session notifications for someone logging on or off a session. However, I am not sure how to get hold of the handle needed as the first argument. I have tried various ways but they don't work, e.g. with GetDesktopWindow the error is that it is the wrong thread. Has anyone got any ideas of how to get hold of the handle of the input desktop which the user logs into? 
    Thursday, June 29, 2017 6:47 PM

Answers

  • >>Yes - this worked

    Please choose "Mark as answer" if the reply helps you. If you have any other concerns, just feel free to contact us. Thanks.

    Best Regards,
    Sera Yu


    MSDN Community Support<br/> Please remember to click &quot;Mark as Answer&quot; the responses that resolved your issue, and to click &quot;Unmark as Answer&quot; if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact <a href="mailto:MSDNFSF@microsoft.com">MSDNFSF@microsoft.com</a>.

    • Marked as answer by cb12__ Tuesday, August 29, 2017 7:57 AM
    Wednesday, July 5, 2017 8:59 AM

All replies

  • Simply use the main window handle in a Win32 GUI app to receive WM_WTSSESSION_CHANGE message in its window procedure.


    • Edited by Castorix31 Thursday, June 29, 2017 7:11 PM
    Thursday, June 29, 2017 7:09 PM
  • ok will try
    Friday, June 30, 2017 7:52 AM
  • Hi cb12__,

    thanks for posting here.

    Have your case been solved? If it has, please help to mark answer. If you have any other concerns, just feel free to contact us.

    Your understanding and cooperation will be grateful.

    Best Regards,
    Sera Yu


    MSDN Community Support<br/> Please remember to click &quot;Mark as Answer&quot; the responses that resolved your issue, and to click &quot;Unmark as Answer&quot; if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact <a href="mailto:MSDNFSF@microsoft.com">MSDNFSF@microsoft.com</a>.

    Monday, July 3, 2017 8:09 AM
  • Yes this now works - many thanks
    Monday, July 3, 2017 4:23 PM
  • >>Yes - this worked

    Please choose "Mark as answer" if the reply helps you. If you have any other concerns, just feel free to contact us. Thanks.

    Best Regards,
    Sera Yu


    MSDN Community Support<br/> Please remember to click &quot;Mark as Answer&quot; the responses that resolved your issue, and to click &quot;Unmark as Answer&quot; if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact <a href="mailto:MSDNFSF@microsoft.com">MSDNFSF@microsoft.com</a>.

    • Marked as answer by cb12__ Tuesday, August 29, 2017 7:57 AM
    Wednesday, July 5, 2017 8:59 AM