I have created a C# Windows Form that uses WTSRegisterSessionNotification to Register for Remote Desktop session notifications. Then I am handling the WM_WTSSESSION_CHANGE message in WndProc callback function. The issue I am having is that I want to achieve the same functionality as a Windows Service.
When I tried the following in a Windows Service project Result = False.
var result = WTSRegisterSessionNotification(Process.GetCurrentProcess().MainWindowHandle, 1);
So I cant even register the notification. Can someone point me in the right direction?