#include<Windows.h>
HINSTANCE g_hInst;
LPCTSTR MyClassName = TEXT("FistClass");
HWND hWndMain,hC1,hC2,hC3;
HBRUSH hRedBrush, hBlueBrush, hGreenBrush;
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK ChildLeftProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK ChildTopProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK ChildBottomProc(HWND, UINT, WPARAM, LPARAM);
int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) {
WNDCLASS wndclass{};
HWND hWnd{};
MSG msg{};
g_hInst = hInstance;
hRedBrush = (HBRUSH)CreateSolidBrush(RGB(255,0,0));
hGreenBrush = (HBRUSH)CreateSolidBrush(RGB(0,255,0));
hBlueBrush = (HBRUSH)CreateSolidBrush(RGB(0,0,255));
wndclass.lpfnWndProc = WndProc;
wndclass.lpszClassName = MyClassName;
wndclass.hInstance = hInstance;
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.cbWndExtra = 0;
wndclass.cbClsExtra = 0;
wndclass.lpszMenuName = NULL;
wndclass.hbrBackground = NULL;
wndclass.style = CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wndclass);
wndclass.hbrBackground = hRedBrush;
wndclass.lpfnWndProc = ChildLeftProc;
wndclass.lpszClassName = TEXT("ChildLeft");
RegisterClass(&wndclass);
wndclass.hbrBackground = hGreenBrush;
wndclass.lpfnWndProc = ChildTopProc;
wndclass.lpszClassName = TEXT("ChildTop");
RegisterClass(&wndclass);
wndclass.hbrBackground = hBlueBrush;
wndclass.lpfnWndProc = ChildBottomProc;
wndclass.lpszClassName = TEXT("ChildBottom");
RegisterClass(&wndclass);
hWnd = CreateWindowExW(NULL, MyClassName, MyClassName,WS_OVERLAPPEDWINDOW|WS_VSCROLL|WS_HSCROLL,CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, NULL,(HMENU)NULL,hInstance,NULL);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
hWndMain = hWnd;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
DeleteObject(hRedBrush);
DeleteObject(hGreenBrush);
DeleteObject(hBlueBrush);
return((int)msg.wParam);
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) {
RECT crt{};
switch (iMessage){
case WM_CREATE:
hC1 = CreateWindowExW(NULL, TEXT("ChildLeft"), NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,
0, 0, 0, 0, hWnd, (HMENU)0, g_hInst, NULL);
hC2 = CreateWindowExW(NULL, TEXT("ChildTop"), NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,
0, 0, 0, 0, hWnd, (HMENU)0, g_hInst, NULL);
hC3 = CreateWindowExW(NULL, TEXT("ChildBottom"), NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,
0, 0, 0, 0, hWnd, (HMENU)0, g_hInst, NULL);
return(0);
case WM_SIZE:
if (wParam != SIZE_MINIMIZED) {
GetClientRect(hWnd, &crt);
MoveWindow(hC1,0,0,300,crt.bottom,TRUE);
MoveWindow(hC2,300,0,crt.right-300,150,TRUE);
MoveWindow(hC3,300,150,crt.right-300,crt.bottom-150,TRUE);
}
return(0);
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return(DefWindowProc(hWnd, iMessage, wParam, lParam));
}
------------------------------------------------------------------------------------------------------------
1) hRedBrush, hBlueBrush, hGreenBrush wWinMainԼ ڵ ȵǴ ? ڵ ȵDZ
DeleteObject ϴ ñմϴ.
2) hRedBrush, hBlueBrush, hGreenBrush DeleteObject ϴ ´ ñմϴ. hdc Ͽ selectobject
ٸ OldhRedBrush Ͽ 缱 ϴ° ƴ ñմϴ. å 164pó ؾ ϴ ó
µ ⼭ ٷ ϴ ñմϴ. hdc Ͽ ʾ ġ
ϴ ñմϴ.
3) hC1,hC2,hC3 hParent(θ) WndProc hWnd ϴ ´ ñմϴ. տ
ش hWnd Է ڷ µ ش ڰ θ ڷ ϸ Ǵ ñմϴ. hInstance
wWinMainڷ θ WndProc ؼ ñմϴ. hWndMain θ ڷ
ߴµ ƿ ʰ ñմϴ.
4) wParam!=SIZE_MINIMIZED ϴ ñմϴ. ˷ֽñ ٶϴ.
μ
동탄맛집
일상그램
증권 per 부업 자격증 고수익 농작물
6개월아기
쇼핑몰부업,대출못갚으면,재테크 팟캐스트
투잡 회사에서✓라이브재테크재택부업추천✓초기비용없는 부업
부업 하는법✓가정주부✓재테크 site womad.life
소액펀드
월미도맛집
피부진정
|
|