.NET/Windows API for .NET

    GetDriveType - Disk Drive 유형 판단

    GetDriveType함수는 지정한 Disk가 어떤 형태의 저장소인지를 판단합니다. Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Integer - VB.NET 선언 [DllImport("kernel32")] public static extern int GetDriveType(string nDrive); - C# 선언 GetDriveType함수호출시 확인하고자 하는 Drive의 최상위 경로만 지정해 주면 해당 Drive의 Type을 반환합니다. 예를 들어 C Drive의 유형을 파악하고자 한다면 다음처럼 호출될 수 있습니다. GetDriveType("C:\") - VB.NET 호출 ..

    SetSysColor - Windows System 색상 설정

    Private Declare Function SetSysColors Lib "user32.dll" (ByVal nChanges As Integer, ByRef lpSysColor As ieSystemColor, ByRef lpColorValues As Integer) As Integer - VB.NET 선언 Public Enum ieSystemColor As Integer iScrollBar = 0 iBackGround = 1 iActiveCaption = 2 iInactiveCaption = 3 iMenu = 4 iWindow = 5 iWindowFrame = 6 iMenuText = 7 iWindowText = 8 iCaptionText = 9 iActiveBorder = 10 iInactiveBor..

    MoveFile - File의 이동및 복사수행

    MoveFile함수는 지정한 File을 다른 곳으로 이동시키고 원래 File은 삭제하는 동작을 수행합니다. Declare Function MoveFile Lib "kernel32" Alias "MoveFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String) As Integer - VB.NET 선언 [DllImport("kernel32")] public static extern int MoveFile(string lpExistingFileName, string lpNewFileName); - C# 선언 MoveFile함수의 첫번째 인수는 이동시킬 대상 File을, 두번째 인수에는 복사해 넣을 위치를 지정합니다. 예를 들어 'C:\..

    IsWindowVisible - 특정 Window가 현재 화면에 보이는지 여부를 판단

    IsWindowVisible함수는 인수로 지정한 Window가 현재 화면에 나타나고 있는 상태인지를 판단합니다. 이는 다른 Window에 의해 해당 Window가 가려져 있는 경우도 포함됩니다. Declare Function IsWindowVisible Lib "user32" Alias "IsWindowVisible" (ByVal hwnd As Integer) As Integer - VB.NET 선언 [DllImport("user32")] public static extern int IsWindowVisible(int hwnd); - C# 선언 예를 들어 Form1 Window가 현재 화면이 보여지고 있는 상태인지를 판단하려면 IsWindowVisible함수는 다음과 같이 호출될 수 있습니다. IsWin..

    PaintDesktop - 배경화면 맞추기

    PaintDesktop함수는 지정한 Device Context구역을 현재 배경화면의 Image상태로 그려냅니다. Declare Function PaintDesktop Lib "user32" Alias "PaintDesktop" (ByVal hdc As Integer) As Integer - VB.NET 선언 [DllImport("user32")] public static extern int PaintDesktop(int hdc); - C# 선언 함수의 인수로는 배경화면과 똑같히 그려질 Device Context를 기술합니다. [Windows API for .NET] - GetDC - Window및 Control의 Device Context 구하기 [Windows API for .NET] - GetWind..

    GetBinaryType - 실행 File 유형 확인

    GetBinaryType함수는 해당 File이 실행 File인지 확인합니다. 이때 실행 File이 맞다면 또 어떠한 유형의 실행 File인지도 확인합니다. Declare Function GetBinaryType Lib "kernel32" Alias "GetBinaryTypeA" (ByVal lpApplicationName As String, ByRef lpBinaryType As Integer) As Integer - VB.NET 선언 [DllImport("kernel32")] public static extern int GetBinaryType(string lpApplicationName, ref int lpBinaryType); - C# 선언 GetBinaryType함수의 첫번째 인수는 해당 File..

    GetWindowRect - Window의 위치및 크기 반환

    GetWindowRect함수는 화면상의 특정 Window에 대한 위치및 크기를 반환하는 함수입니다. Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Integer, ByRef lpRect As RECT) As Integer - VB.NET 선언 [DllImport("user32")] public static extern int GetWindowRect(int hwnd, ref RECT lpRect); - C# 선언 선언 GetWindowRect함수의 첫번째 인수는 위치및 크기를 얻고자 하는 Window의 Handle을 지정하고 두번째 인수에 실제 위치와 크기에 대한 값이 저장될 구조체를 지정합니다. 여기서 사..

    DrawText - 화면에 Text문자열 출력

    DrawText는 화면상에 지정한 Text 내용을 출력합니다. Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Integer, ByVal lpStr As String, ByVal nCount As Integer, ByRef lpRect As RECT, ByVal wFormat As Integer) As Integer - VB.NET 선언 [DllImport("user32")] public static extern int DrawText(int hdc, string lpStr, int nCount, ref RECT lpRect, int wFormat); - C# 선언 DrawText함수의 첫번째 인수는 문자열을 표시할 장치의 H..