I am having a problem using ...
[DllImport("user32")] public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
... and then...
SendMessage(???, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, (IntPtr)MONITOR_OFF);
SendMessage wants to process the form, but I do not use Forms, so I cannot get Handle.
Is there any other way by which I can put the monitor to sleep or get Handle in WPF?
source share