.NET

    GetFocus - 현재 Focus에 있는 Form또는 Control의 handle값 반환

    GetFocus는 현재 Focus상태에 있는 Control이나 Form의 handle값을 반환하는 함수 입니다. Declare Function GetFocus Lib "user32" Alias "GetFocus" () As Integer ▶VB.NET 선언 GetFocus() ▶VB.NET 호출 [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern int GetFocus(); ▶C# 선언 GetFocus() ▶C# 호출 참고로 이 함수는 Form이나 Control의 handle method의 반환값과 같습니다.

    GetActiveWindow - 현재 프로그램의 윈도우 핸들값

    Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Integer ▶VB.NET 선언 GetActiveWindow() ▶VB.NET 호출 [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern int GetActiveWindow(); ▶C# 선언 GetActiveWindow() ▶C# 호출 GetActiveWIndow는 현재 함수를 호출하고 있는 Program(Thread)과 관련된 Windows의 handle값을 반환합니다. 만일 관련된 Windows화면이 존재하지 않는 경우에는 null을 반환합니다.

    ActivateKeyboardLayout - Keyboard 언어별 선택함수

    ActivateKeyboardLayout - Keyboard 언어별 선택함수

    Windows OS에 다음과 같이 Keyboard가 언어별로 설정되어 있을때 ActivateKeyboardLayout 함수는 Keyboard설정중 하나를 선택할 수 있도록 합니다. Declare Function ActivateKeyboardLayout Lib "user32" Alias "ActivateKeyboardLayout" (ByVal HKL As Integer, ByVal flag As Integer) As Integer ▶VB.NET 선언 Private Const HKL_NEXT As Integer = 0 Private Const HKL_PREV As Integer = 1 ActivateKeyboardLayout(HKL_NEXT, 8) ▶VB.NET 호출 [System.Runtime.Intero..

    CopyMemory - Memory 복사

    Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Char, ByRef Source As Char, ByVal Length As Integer) ▶VB.NET 선언 Dim a As Char = "X" Dim B As Char CopyMemory(B, a, 1) B ▶VB.NET 호출 [System.Runtime.InteropServices.DllImport("kernel32.dll")] public static extern void CopyMemory(ref char Destination, ref char Source, int Length); ▶C# 선언 char a = 'X'; char B = ' '; Co..

    SystemParameterInfo - Windows System 환경설정

    SystemParameterInfo API함수는 제어판이나 기타 다른방식등을 통해 설정가능한 Windows OS의 여러가지 환경을 제어할 수 있는 함수입니다. 1. 배경화면 변경 Declare Function SystemParametersInfo Lib "user32.dll" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer ▶VB.NET 선언 Declare Auto Function SystemParametersInfo Lib "user32.dll" (ByVal uAction As Integer,..

    SetComputerName - Computer Network 이름 바꾸기

    Declare Function SetComputerName Lib "Kernel32" Alias "SetComputerNameA" (ByVal IpComputerName As String) As Integer ▶C# 선언 If SetComputerName("OpenLab") = 0 Then MessageBox.Show("Computer 이름 바꾸기 실패") Else MessageBox.Show("Computer 이름 바꾸기 성공") End If ▶C# 호출 [System.Runtime.InteropServices.DllImport("Kernel32.dll")] private static extern int SetComputerName(string IpComputerName); ▶VB.NET 선언 if (..

    GetWindowsDirectory - 운영체제 설치경로

    Declare Function GetWindowsDirectory Lib "Kernel32" Alias "GetWindowsDirectoryA" (ByVal Name As String, ByVal Size As Integer) As Integer ▶VB.NET 선언 Dim sName As String = Space(10) GetWindowsDirectory(sName, 11) sName ▶VB.NET 호출 [System.Runtime.InteropServices.DllImport("Kernel32.dll")] private static extern int GetWindowsDirectory(StringBuilder Name, int Size); ▶C# 선언 StringBuilder sName = new ..

    GetUseName - 현재 윈도우 사용자 이름 구하기

    GetUseName는 윈도우 사용자의 이름을 구하는 API함수 입니다. 이 함수대신 다음과 같은 .net Class를 이용하십시오. System.Security.Principal.WindowsIdentity.GetCurrent.Name.Trim() ▶VB.NET System.Security.Principal.WindowsIdentity.GetCurrent().Name.Trim(); ▶C#