티스토리 뷰

Programing

모니터 C#으로 끄기

ned3y2k 2013. 9. 3. 10:27

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;


using System.Runtime.InteropServices;


namespace WindowsFormsApplication1

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }


        const int WM_SYSCOMMAND = 0x0112;

        const int SC_MONITORPOWER = 0xF170;

        const int ON = -1;

        const int OFF = 2;


        [DllImport("user32.dll", SetLastError = true)]

        private static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);



        private void button1_Click(object sender, EventArgs e)

        {

            SendMessage(this.Handle, WM_SYSCOMMAND, new IntPtr(SC_MONITORPOWER), new IntPtr(OFF));

        }

    }

}


참고문서: http://www.kev009.com/wp/projects/lcdoff/


첨부파일: LCDoff.zip 은 어셈으로 작성된 코드이다.


'Programing' 카테고리의 다른 글

Windows 10 설정 앱 스키마  (0) 2017.08.23
.NET Code Conversion?  (0) 2012.11.07
MySQL UPDATE JOIN 예제  (0) 2012.02.28
C# private 필드 리플렉션  (0) 2012.01.16
구글 api 모음  (0) 2012.01.10
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함