첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
------------------------------------------------------------------------------------------------------------------------------------------------------
728x90
728x170

TestProject.zip
0.00MB

▶ Program.cs

using System;
using System.Runtime.InteropServices;

namespace TestProject
{
    /// <summary>
    /// 프로그램
    /// </summary>
    class Program
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Import
        ////////////////////////////////////////////////////////////////////////////////////////// Static
        //////////////////////////////////////////////////////////////////////////////// Private

        #region 키보드 이벤트 발생시키기 - keybd_event(virtualKey, scanCode, flag, extraInformationHandle)

        /// <summary>
        /// 키보드 이벤트 발생시키기
        /// </summary>
        /// <param name="virtualKey">가상 키</param>
        /// <param name="scanCode">스캔 코드</param>
        /// <param name="flag">플래그</param>
        /// <param name="extraInformationHandle">부가 정보 핸들</param>
        [DllImport("user32")]
        private static extern void keybd_event(byte virtualKey, byte scanCode, uint flag, IntPtr extraInformationHandle);

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Field
        ////////////////////////////////////////////////////////////////////////////////////////// Private

        #region Field

        /// <summary>
        /// KEYEVENTF_EXTENDEDKEY
        /// </summary>
        private const uint KEYEVENTF_EXTENDEDKEY = 0x01;

        /// <summary>
        /// KEYEVENTF_KEYUP
        /// </summary>
        private const uint KEYEVENTF_KEYUP = 0x02;


        /// <summary>
        /// VK_SCROLL
        /// </summary>
        private const byte VK_SCROLL = 0x91;

        /// <summary>
        /// VK_NUMLOCK
        /// </summary>
        private const byte VK_NUMLOCK = 0x90;

        /// <summary>
        /// VK_CAPITAL
        /// </summary>
        private const byte VK_CAPITAL = 0x14;

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Static
        //////////////////////////////////////////////////////////////////////////////// Private

        #region 프로그램 시작하기 - Main()

        /// <summary>
        /// 프로그램 시작하기
        /// </summary>
        private static void Main()
        {
            uint keyDown = KEYEVENTF_EXTENDEDKEY;
            uint keyUp   = KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP;
 
            keybd_event(VK_NUMLOCK, (byte)0, keyDown, new IntPtr(0));
            keybd_event(VK_NUMLOCK, (byte)0, keyUp  , new IntPtr(0));
 
            keybd_event(VK_CAPITAL, (byte)0, keyDown, new IntPtr(0));
            keybd_event(VK_CAPITAL, (byte)0, keyUp  , new IntPtr(0));
 
            keybd_event(VK_SCROLL, (byte)0, keyDown, new IntPtr(0));
            keybd_event(VK_SCROLL, (byte)0, keyUp  , new IntPtr(0));
        }

        #endregion
    }
}
728x90
그리드형(광고전용)
Posted by icodebroker
,