분류 전체보기
GetSystemInfo - System 정보조회
GetSystemInfo함수는 Computer System의 각종 정보를 알아내는 API함수입니다. Declare Sub GetSystemInfo Lib "kernel32" Alias "GetSystemInfo" (ByRef SystemInfo As _SYSTEMINFO) Structure _SYSTEMINFO Public iOem As Integer Public iPgSize As Integer Public iApp_min_addr As Integer Public iApp_max_addr As Integer Public iActive_prs_mak As Integer Public iPrs_number As Integer Public iPrs_type As Integer Public iGranularit..
ExitWindowsEx - System종료및 Logoff 하기
ExitWindowsEx함수는 현재 System을 종료하거나 Logoff하는 함수입니다. Declare Function ExitWindowsEx Lib "user32" Alias "ExitWindowsEx" (ByVal uFlags As Integer, ByVal dwReserved As Integer) As Integer ▶VB.NET 선언 [DllImport("user32")] public static extern int ExitWindowsEx(int uFlags, int dwReserved); ▶C# 선언 ExitWindowsEx함수의 첫번째 인수는 함수가 어떤 동작을 수행할지 지정하는 Flag로서 다음 상수를 사용할 수 있습니다. 상수 값 설명 EWX_LOGOFF 0 Logoff 합니다. EWX..
WindowFromPoint - 위치에 따른 Window의 Handle값 취득
WindowFromPoint함수는 특정 위치에 있는 Window의 Handle을 반환하는 함 수 입니다. Declare Function WindowFromPoint Lib "user32" Alias "WindowFromPoint" (ByVal lpPoint As Point) As Integer ▶VB.NET 선언 [DllImport("user32.dll")] public static extern int WindowFromPoint(Point lpPoint); ▶C# 선언 함수의 인수로는 Handle을 가져올 Window가 있는 위치를 Point로 지정합니다. 아래는 현재 Form의 X, Y위치를 가리키는 예제입니다. Dim ptCursor As Point = New Point() ptCursor.X = ..
SetSystemTime - System날짜및 시간설정
SetSystemTime함수는 System의 날짜및 시간을 설정하는 함수입니다. Declare Function SetSystemTime Lib "kernel32" Alias "SetSystemTime" (ByRef lpSystemTime As SYSTEMTIME) As Integer ▶VB.NET 선언 [DllImport("kernel32")] public static extern int SetSystemTime(ref SYSTEMTIME lpSystemTime); ▶C# 선언 함수의 인수로는 변경할 시간이 저장된 SYSTEMTIME구조체를 기술하면 되는데 이 구조체는 다음과 같이 선언될 수 있습니다. Public Structure SYSTEMTIME Public wYear As Short '년도 Pub..
CopyFile - File복사
CopyFile함수는 인수로 지정한 File을 복사하는 함수입니다. Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Boolean) As Integer ▶VB.NET 선언 [DllImport("kernel32")] public static extern int CopyFile(string lpExistingFileName, string lpNewFileName, bool bFailExists); ▶C# 선언 CopyFile함수의 첫번째 인수는 복사할 File의 위치및 이름을, 두번째 인수에..
SetFileAttributes - File의 속성설정
SetFileAttributes함수는 File의 속성을 설정합니다. Declare Function SetFileAttributes Lib "kernel32" Alias "SetFileAttributesA" (ByVal lpFileName As String, ByVal dwFileAttributes As Integer) As Integer ▶VB.NET 선언 [DllImport("kernel32")] public static extern int SetFileAttributes(string lpFileName, int dwFileAttributes); ▶C# 선언 SetFileAttributes함수의 첫번째 인수는 속성을 설정할 File이 있는 경로와 이름을 지정하고 두번째 인수에서는 File에 설정할 속성..
GetWindowTextLength - 특정 Window의 제목문자열 크기구하기
GetWindowTextLength함수는 지정한 Window의 제목문자열 크기값을 반환합니다. Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer ▶VB.NET 선언 [DllImport("user32")] public static extern int GetWindowTextLength(int hwnd); ▶C# 선언 GetWindowTextLength함수의 인수로는 제목문자열 크기를 구하고자할 Window의 Handle을 전달해 주기만 하면 됩니다. 예를 들어 현재 실행중인 From Window의 제목문자열 크기를 구하려면 다음과 같이 함수를 호출하면 됩..
GetDeviceCaps - Device Context의 정보 구하기
GetDeviceCaps함수는 지정된 Device Context의 여러 정보를 구하는 함수입니다. Declare Function GetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" (ByVal hdc As Integer, ByVal nIndex As Integer) As Integer ▶VB.NET 선언 [DllImport("gdi32")] public static extern int GetDeviceCaps(int hdc, int nIndex); ▶C# 선언 GetDeviceCaps함수는 첫번째 인수에서 정보를 구하고자할 Device Context를 지정하며 두번째 인수에서 어떠한 종류의 정보를 가져올지에 대한 flag를 지정합니다. 이때 지정할 수 있는 flag의 종..