[WINAPI]DC, PAINTSTRUCT(GetDC, ReleaseDC, BeginPain, EndPaint)


HDC


HDC GetDC(HWND hWnd);


WinUser.h
GetDC(_In_opt_ HWND hWnd);


int ReleaseDC(HWND hWnd, HDC hDC);


WinUser.h
ReleaseDC(_In_opt_ HWND hWnd,_In_ HDC hDC);


HDC BeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint);


WinUser.h
BeginPaint(_In_ HWND hWnd,_Out_ LPPAINTSTRUCT lpPaint);


BOOL EndPaint(HWND hWnd, CONST PAINTSTRUCT *lpPaint);


WinUser.h
EndPaint(_In_ HWND hWnd,_In_ CONST PAINTSTRUCT *lpPaint);

PAINTSTRUCT


WinUser.h
typedef struct tagPAINTSTRUCT {
HDC hdc;
BOOL fErase;
RECT rcPaint;
BOOL fRestore;
BOOL fIncUpdate;
BYTE rgbReserved[32];
} PAINTSTRUCT, *PPAINTSTRUCT, *NPPAINTSTRUCT, *LPPAINTSTRUCT;

GetDC와 ReleaseDC는 한셋트 이며 보통 이렇게 사용된다.


HDC hdc;
....
case WM_PAINT:
hdc = GetDC(hwnd);
...
ReleaseDC(hwnd, hdc);

BeginPaint와 EndPaint도 마찬가지로 한셋트이다.


HDC hdc;
PAINTSTRUCT ps;
...
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
...
EndPaint(hwnd, &ps);

“[WINAPI]DC, PAINTSTRUCT(GetDC, ReleaseDC, BeginPain, EndPaint)”에 대한 2개의 댓글

댓글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다