.NET

    FillRect - 채워진 사각형 그리기

    FillRect함수는 안이 채워진 사각형을 그리는 함수입니다. Declare Function FillRect Lib "user32" Alias "FillRect" (ByVal hdc As Integer, ByRef lpRect As RECT, ByVal hBrush As Integer) As Integer - VB.NET 선언 [DllImport("user32")] public static extern int FillRect(int hdc, ref RECT lpRect, int hBrush); - C# 선언 FillRect함수의 첫번째 인수는 실제 사각형을 그릴 Object의 Device Context를 지정해야 합니다. [Windows API for .NET] - GetDC - Window및 Contr..

    CreateSolidBrush - Solid형 Line을 그리는 Brush생성

    CreateSolidBrush함수는 다른 API를 통해 Graphic를 그릴때 사용되는 Solid Brush를 생성하고 생성된 해당 Brush의 Handle을 반환합니다. Declare Function CreateSolidBrush Lib "gdi32" Alias "CreateSolidBrush" (ByVal crColor As Integer) As Integer - VB.NET 선언 [DllImport("gdi32")] public static extern int CreateSolidBrush(int crColor); - C# 선언 CreateSolidBrush는 말 그대로 그림을 그릴 수 있는 붓을 생성하는데 이때 붓의 색상을 CreateSolidBrush함수의 인수로 전달해야 합니다. 예를 들어 파..

    GetTickCount - Windows가동 시간알아내기

    GetTickCount함수는 Windows OS가 처음 Booting된 이후 현재까지 작동된 시간을 1/00초단위로 반환합니다. Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Integer - VB.NET 선언 [DllImport("kernel32")] public static extern int GetTickCount(); - C# 선언 다음은 MessageBox를 통해 GetTickCount함수의 반환값을 확인하는 예제입니다. MessageBox.Show(GetTickCount()) - VB.NET 호출 MessageBox.Show(GetTickCount().ToString()); - C# 호출

    GetFileAttributes - File및 Folder속성 확인

    GetFileAttributes함수는 지정한 File이나 Folder의 속성을 확인하는 함수입니다. Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Integer - VB.NET 선언 [DllImport("kernel32")] public static extern int GetFileAttributes(string lpFileName); - C# 선언 함수의 인수로는 속성을 확인할 File이나 Folder를 지정해 주기만 하면 됩니다. 예를 들어 'C:\WINDOWS'의 'abc.txt' File을 확인해 보려면 함수를 다음과 같이 선언합니다. GetFileA..

    DrawFocusRect - 선택모양의 점선사각형 그리기

    DrawFocusRect함수는 마치 해당 위치로 Focus가 이동한 듯한 점선모양의 사각형을 그립니다. Declare Function DrawFocusRect Lib "user32" Alias "DrawFocusRect" (ByVal hdc As Integer, ByRef lpRect As RECT) As Integer - VB.NET 선언 [DllImport("user32")] public static extern int DrawFocusRect(int hdc, ref RECT lpRect); - C# 선언 DrawFocusRect함수의 첫번째 인수는 사각형을 표시할 Device Context를 기술합니다. [Windows API for .NET] - GetDC - Window및 Control의 Dev..

    SetVolumeLabel - Volume의 이름설정

    SetVolumeLabel함수는 지정한 Volume의 이름을 설정하도록 합니다. Declare Function SetVolumeLabel Lib "kernel32" Alias "SetVolumeLabelA" (ByVal lpRootPathName As String, ByVal lpVolumeName As String) As Integer - VB.NET 선언 [DllImport("kernel32")] public static extern int SetVolumeLabel(string lpRootPathName, string lpVolumeName); - C# 선언 이 함수의 첫번째 인수로는 이름을 지정할 Drive의 최상위 경로를 지정해 하고 두번째 인수에서 해당 Drive의 이름을 지정하면 됩니다. 예..

    DestoryWindow - Window화면 닫기

    DestoryWindow함수는 지정한 Window를 닫도록 합니다. 해당 Window화면이 다른 Window에 의해 생성된 경우라면 부모 Window까지 모두 닫아버립니다. Declare Function DestoryWindow Lib "user32" Alias "DestroyWindow" (ByVal hwnd As Integer) As Integer - VB.NET 선언 [DllImport("user32")] public static extern int DestoryWindow(int hwnd); - C# 선언 DestoryWindow함수를 통해 특정 Window를 닫고자 한다면 인수로 해당 Window화면의 Handle값만 건네주면 됩니다. 예를 들어 닫고자 하는 Window의 Handle이 100이..

    SHGetSpecialFolderPath - Windows System관련 Folder 가져오기

    SHGetSpecialFolderPath는 Windows운영체제의 여러가지 지정된 특수Folder의 경로를 조회하는 함수입니다. _ Private Shared Function SHGetSpecialFolderPath(ByVal hwndOwner As IntPtr, ByVal lpszPath As StringBuilder, ByVal nFolder As Integer, ByVal fCreate As Boolean) As Boolean End Function - VB.NET 선언 [DllImport("shell32.dll")] static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, [Out] StringBuilder lpszPath, int nFolder,..