사용자 도구

사이트 도구

English

cuwin:cuwin_백라이트_on_ooff하기:index

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
cuwin:cuwin_백라이트_on_ooff하기:index [2016/04/14 09:49]
127.0.0.1 바깥 편집
cuwin:cuwin_백라이트_on_ooff하기:index [2017/11/25 02:15] (현재)
Comfile Technology
줄 1: 줄 1:
 +====== CUWIN 백라이트 On / OOff하기 ======
 +
 +CUWIN 백라이트를 소프트웨어적으로 ON /OFF하는 소스코드입니다.
 +
 +{{ :​cuwin:​cuwin_백라이트_on_ooff하기:​backlite.png?​nolink |}}
 +
 +[[http://​www.comfile.co.kr/​download/​etc/​CuwinBacklightOnOff.zip|소스프로그램 다운]]
 +
 +<code csharp>
 +using System;
 +using System.Linq;​
 +using System.Collections.Generic;​
 +using System.ComponentModel;​
 +using System.Data;​
 +using System.Drawing;​
 +using System.Text;​
 +using System.Windows.Forms;​
 +using System.Runtime.InteropServices;​
 + 
 +namespace CuwinBacklightOnOff
 +{
 +    public partial class Form1 : Form
 +    {
 +        private const int POWER_NAME = 1;
 +        private const int POWER_FORCE = 0x00001000;
 + 
 +        /// <​summary>​
 +        /// "​BLK1:"​ for CUWIN 5000/6000, "​BAK1:"​ for CUWIN 3000/4000 series
 +        /// </​summary>​
 +        private const string BACKLIGHT_DEVICE_NAME = "​BKL1:";  ​
 + 
 +        private enum DevicePowerState : int
 +        {
 +            Unspecified = -1,
 +            D0 = 0, // Full On: full power, full functionality ​
 +            D1, // Low Power On: fully functional at low power/​performance ​
 +            D2, // Standby: partially powered with automatic wake 
 +            D3, // Sleep: partially powered with device initiated wake 
 +            D4, // Off: unpowered ​
 +        }
 + 
 +        /// <​summary>​
 +        /// Sets the power state for a device
 +        /// </​summary>​
 +        [DllImport("​coredll.dll",​ SetLastError = true)]
 +        private static extern int SetDevicePower
 +        (
 +            string pvDevice,
 +            int dwDeviceFlags,​
 +            DevicePowerState DeviceState
 +        );
 + 
 +        /// <​summary>​
 +        /// Turns Backlight On
 +        /// </​summary>​
 +        private void TurnBacklightOn()
 +        {
 +            SetDevicePower(BACKLIGHT_DEVICE_NAME,​ POWER_NAME, DevicePowerState.D0);​
 +        }
 + 
 +        /// <​summary>​
 +        /// Turns Backlight Off
 +        /// </​summary>​
 +        private void TurnBacklightOff()
 +        {
 +            SetDevicePower(BACKLIGHT_DEVICE_NAME,​ POWER_NAME, DevicePowerState.D4);​
 +        }
 + 
 +        public Form1()
 +        {
 +            InitializeComponent();​
 +        }
 + 
 +        /// <​summary>​
 +        /// On button'​s Click Event Hander
 +        /// </​summary>​
 +        private void OnButton_Click(object sender, EventArgs e)
 +        {
 +            TurnBacklightOn();​
 +        }
 + 
 +        /// <​summary>​
 +        /// Off button'​s Click Event Hander
 +        /// </​summary>​
 +        private void OffButton_Click(object sender, EventArgs e)
 +        {
 +            TurnBacklightOff();​
 +        }
 +    }
 +}
 +</​code>​
 +
 +<​html>​ <​center>​
 +<iframe width="​544"​ height="​306"​ src="​http://​serviceapi.nmv.naver.com/​flash/​convertIframeTag.nhn?​vid=155D667F34924197A5AF463C2458197E492A&​outKey=V123e80aee04379b3cf27acb9dc3074b7360cce2ee458595fb388acb9dc3074b7360c"​ frameborder="​no"​ scrolling="​no"></​iframe>​
 +</​center>​ </​html>​
 +
 +[[cuwin:​index|한단계 뒤로]]
 +