Turn-off monitor using c#.net
-
Hi all, I need to turn offpower-off) the remote computer(Machine) monitor.Can any help me on this scenario.Is it is possible to do by c#.net. Let me clearly explain me there are Server and clients... From server machine I need to turn off(power-off) the client system monitor kindly help me....
-
Hi all, I need to turn offpower-off) the remote computer(Machine) monitor.Can any help me on this scenario.Is it is possible to do by c#.net. Let me clearly explain me there are Server and clients... From server machine I need to turn off(power-off) the client system monitor kindly help me....
-
Hi all, I need to turn offpower-off) the remote computer(Machine) monitor.Can any help me on this scenario.Is it is possible to do by c#.net. Let me clearly explain me there are Server and clients... From server machine I need to turn off(power-off) the client system monitor kindly help me....
You can try with this code.. [DllImport("user32.dll")] static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); //Or [DllImport("user32.dll", SetLastError = true)] static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); //Or [DllImport("user32.dll")] static extern bool PostThreadMessage(uint idThread, uint Msg, UIntPtr wParam, IntPtr lParam); //Or [DllImport("user32.dll", SetLastError=true, CharSet=CharSet.Auto)] static extern bool SendMessageCallback(IntPtr hWnd, uint Msg, UIntPtr wParam, IntPtr lParam, SendMessageDelegate lpCallBack, UIntPtr dwData); //Or [DllImport("user32.dll", SetLastError=true, CharSet=CharSet.Auto)] static extern bool SendNotifyMessage(IntPtr hWnd, uint Msg, UIntPtr wParam, IntPtr lParam); //Or [DllImport("user32.dll")] private static extern IntPtr GetDesktopWindow(); //Or [DllImport("user32.dll", SetLastError = true)] static extern IntPtr FindWindow(string lpClassName, string lpWindowName); //Or [DllImport("user32.dll", SetLastError = true)] static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); const int SC_MONITORPOWER = 0xF170; const int WM_SYSCOMMAND = 0x0112; const int MONITORON = -1; const int MONITOROFF = 2; const int MONITORSTANBY = 1; int HWND_BROADCAST = 0xffff; //the message is sent to all top-level windows in the system int HWND_TOPMOST = -1; int HWND_TOP = 0; // int HWND_BOTTOM = 1; //limited use int HWND_NOTOPMOST = -2; // Form frm = new Form(); Frm.Handle(); SendMessage(ValidHWND, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOROFF ); SendMessage(ValidHWND, WM_SYSCOMMAND, SC_MONITORPOWER, MONITORON);