.NET/Windows API for .NET

    GetClientRect - Window나 Control의 좌표값 얻기

    Declare Function GetClientRect Lib "user32" Alias "GetClientRect" (ByVal hwnd As Integer, ByRef lpRect As RECT) As Integer - VB.NET 선언 [DllImport("user32")] public static extern int GetClientRect(int hwnd, ref RECT lpRect); - C# 선언 GetClientRect함수의 첫번째 인수는 좌표를 구하고자할 Window나 Control의 Handle을 넘기고 두번째 인수에는 해당 좌표값을 담아둘 구조체를 기술합니다. 만일 현재 실행중인 Form의 위치및 좌표를 구하고자 한다면 GetClientRect함수는 다음과 같이 선언될 수 있습니다...

    keybd_event - Keyboard또는 Mouse입력함수

    keybd_event 함수는 실제 Keyboard의 특정 Key나 Mouse의 Button을 누른 것과 같은 효과를 발생시킵니다. Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer) - VB.NET 선언 Private Const VK_CAPITAL = &H14 keybd_event(VK_CAPITAL, 0, 0, 0) - VB.NET 호출 [DllImport("user32.dll")] public static extern bool keybd_event(byte bVk, byte bScan, int dwFl..

    EnableWindow - Program(Window)및 특정 Control사용가능여부설정

    Declare Function EnableWindow Lib "user32" Alias "EnableWindow" (ByVal hwnd As Integer, ByVal fEnable As Boolean) As Integer - VB.NET 선언 EnableWindow(Me.Handle, False) 'Windows Form 제어 예제 EnableWindow(Button1.Handle, False) '특정 Control 제어 예제 - VB.NET 호출 [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern int EnableWindow(int hwnd, bool fEnable); - C# 선언 EnableWindow((i..

    LoadCursorFromFile - 새로운 Mouse Cursor의 Load

    LoadCursorFromFile 함수는 Computer에 저장되어 있는 Mouse Cursor File(cur, ani)을 Load하는 함수입니다. Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Integer - VB.NET 선언 LoadCursorFromFile(path) - VB.NET 호출 [DllImport("user32.dll")] public static extern int LoadCursorFromFile(string lpFileName); - C# 선언 LoadCursorFromFile(path); - C# 호출 LoadCursorFromFi..

    가상 Key Code표

    Code(16진수) 상수명 Key 1 VK_LBUTTON mouse 왼쪽 button 2 VK_RBUTTON mouse 오른쪽 button 3 VK_CANCEL 취소와 상동 4 VK_MBUTTON mouse 가운데 button(scroll button) 5 VK_XBUTTON1 mouse 특수기능 button1 6 VK_XBUTTON2 mouse 특수기능 button2 8 VK_BACK 삭제 button(←) 9 VK_TAB TAB 0C VK_CLEAR Clear와 상동 0D VK_RETURN ENTER 10 VK_SHIFT SHIFT 11 VK_CONTROL CTRL 12 VK_MENU ALT 13 VK_PAUSE PAUSE BREAK 14 VK_CAPITAL CAPS LOCK 15 VK_KANA IM..

    GetCursorPos - Mouse Pointer의 현재위치 반환

    GetCursorPos함수는 현재 화면상에서 Mouse Pointer의 위치를 반환합니다. Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (ByRef lpPoint As POINTAPI) As Integer - VB.NET 선언 Public Structure POINTAPI Public x As Integer Public y As Integer End Structure Dim pntapi As POINTAPI GetCursorPos(pntapi) pntapi.x pntapi.y - VB.NET 호출 [DllImport("user32.dll")] public static extern int GetCursorPos(ref POINTAPI l..

    LoadkeyboardLayout - Keyboard 배열 가져오기

    LoadKeyboardLayout함수는 함수가 호출된 현재 Process에 인수로 지정한 Keyboard Layout을 가져올 수 있도록 합니다. Declare Function LoadKeyboardLayout Lib "user32" Alias "LoadKeyboardLayoutA" (ByVal pwszKLID As String, ByVal flags As Integer) As Integer ▶VB.NET 선언 'flag 상수 Private Const KLF_ACTIVATE As Integer = &H1 Private Const KLF_NOTELLSHELL As Integer = &H80 Private Const KLF_REORDER As Integer = &H8 Private Const KLF_REPL..

    GetKeyboardLayoutName - Keyboard Layout 이름 반환

    GetKeyboardLayout 함수는 현재 함수가 실행되고 있거나 인수로 전달된 Thread에서 사용되고 있는 Keyboard Layout의 이름을 반환하지만 GetKeyboardLayoutName함수는 System에 기본적으로 설정되어 있는 Layout의 이름을 반환합니다. Declare Function GetKeyboardLayoutName Lib "user32" Alias "GetKeyboardLayoutNameA" (ByVal pwszKLID As String) As Integer VB.NET 선언 Dim kbln As String = Space(8) GetKeyboardLayoutName(kbln) VB.NET 호출 [System.Runtime.InteropServices.DllImport("..