본문 바로가기
::public/윈도우즈 응용 프로그래밍

Window Class

by 해맑은욱 2019. 9. 22.
// WinUser.h 에 정의되어 있음.
typedef struct tagWNDCLASSEXW {
    // Window Class의 구조체의 크기 값.
    UINT        cbSize;
/* Win 3.x */
    // Window의 그리기 특성과 관련된 정보를 설정하거나 
    // 몇 가지 사용자 환경을 추가하거나 제한하는 값을 저장.
    UINT        style;
    // Window에 전달된 메시지를 처라하는 함수.
    // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){...}
    WNDPROC     lpfnWndProc;
    // 동일한 Window Class를 사용하는 Window 들이 공유할 수 있는 메모리의 크기를 설정.
    int         cbClsExtra;
    // Window Class를 사용하는 Window를 위한 개별 메모리를 추가해 줌.
    int         cbWndExtra;
    // Windows 운영체제가 실행된 응용 프로그램을 구별하기 위한 고유의 값
    HINSTANCE   hInstance;
    // Window 좌측 상단에 표시되는 작은 아이콘. 로고 이미지로 사용할 아이콘의 핸들 값을 저장.
    HICON       hIcon;
    // Window의 클라이언트 영역에 마우스가 위치했을 때 사용할 마우스 커서에 대한 핸들 값을 저장.
    HCURSOR     hCursor;
    // Window 배경을 그릴 때 사용할 Brush Object에 대한 핸들 값을 저장.
    HBRUSH      hbrBackground;
    // Window가 사용할 메뉴 이름을 저장.
    LPCWSTR     lpszMenuName;
    // Window Class 이름을 유니코드 문자열 형식으로 저장.
    // 중복되지 않도록 이름이 잘 구별되게 지을것.
    LPCWSTR     lpszClassName;
/* Win 4.0 */
    HICON       hIconSm;
} WNDCLASSEXW, *PWNDCLASSEXW, NEAR *NPWNDCLASSEXW, FAR *LPWNDCLASSEXW;
 
// Window Class 구성하기.
WNDCLASSEXW wcex;
 
wcex.cbSize         = sizeof(WNDCLASSEX);    // 48. 구조체 크기 설정.
wcex.style          = CS_HREDRAW | CS_VREDRAW; // 세로축&가로축 크기가 변할 시 윈도우를 다시 그림.
wcex.lpfnWndProc    = WndProc;    // 메인 윈도우에선 WndProc 외에는 잘 안쓰임.
wcex.cbClsExtra     = 0;
wcex.cbWndExtra     = 0;
wcex.hInstance      = hInstance;
wcex.hIcon          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DRAWRECTANGLE));
wcex.hCursor        = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName   = MAKEINTRESOURCEW(IDC_DRAWRECTANGLE);
wcex.lpszClassName  = "클래스 이름";
wcex.hIconSm        = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
cs

 

https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-wndclassexa

 

WNDCLASSEXA (winuser.h)

Contains window class information.

docs.microsoft.com

https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-wndclassexw

 

WNDCLASSEXW (winuser.h)

Contains window class information.

docs.microsoft.com

 

'::public > 윈도우즈 응용 프로그래밍' 카테고리의 다른 글

CreateBitmap / CreateCompatibleBitmap  (0) 2019.09.23
Windows API  (0) 2019.09.23
기본 소스 코드 구성(생략본)  (0) 2019.09.23
HINSTANCE  (0) 2019.09.22
핸들(Handle)  (0) 2019.09.22