Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Hardware & Devices
  4. Turn-off monitor using c#.net

Turn-off monitor using c#.net

Scheduled Pinned Locked Moved Hardware & Devices
csharpsysadminhelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    balu12345
    wrote on last edited by
    #1

    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....

    J J 2 Replies Last reply
    0
    • B balu12345

      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....

      J Offline
      J Offline
      Johpoke
      wrote on last edited by
      #2

      Wizmo[^] can do it for you. Look at the blindlock and monoff commands. You can easily call wizmo from a batch file with the command(s) you want to use. :)

      //Johannes

      1 Reply Last reply
      0
      • B balu12345

        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....

        J Offline
        J Offline
        Jagadeesan Kandasamy
        wrote on last edited by
        #3

        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);

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups