- May 15, 2007
- 45
- 3
- Home Country
-
Germany
Hi,
when i'm lying in bed to listen to music i want to shutdown my monitor with my remote. So i started to write a small plugin with the same code i have already used in other programs where it works nice.
But in my plugin the code does not work, indeed nothing happens when the function to shutdown the Monitor is called.
Anyone an idea why it isn't working from inside MP?
when i'm lying in bed to listen to music i want to shutdown my monitor with my remote. So i started to write a small plugin with the same code i have already used in other programs where it works nice.
But in my plugin the code does not work, indeed nothing happens when the function to shutdown the Monitor is called.
Code:
[DllImport("c:/Windows/System32/user32.dll")]
public static extern int SendMessage(int hWnd, uint Msg, long wParam, long lParam);
private const int WM_SYSCOMMAND = 0x0112;
private const int SC_MONITORPOWER = 0xF170;
private const int HWND_BROADCAST = 0xFFFF;
private void disable_monitor()
{
SendMessage((int)HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2);
}
Anyone an idea why it isn't working from inside MP?