VC++ DialogBox의 윈도우 옮기기
BOOL CALLBACK DialogProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
int x, y;
RECT rect;
switch (iMsg)
{
case WM_INITDIALOG:
GetClientRect(hWnd, &rect); // 현재 윈도우의 크기 얻기
x=::GetSystemMetrics(SM_CXSCREEN); // 모니터의 가로 전체 크기 얻기
y=::GetSystemMetrics(SM_CYSCREEN); // 모니터의 세로 전체 크기 얻기
x=(x-rect.right)/2;
y=(y-rect.bottom)/2;
MoveWindow(hWnd, x, y, rect.right, rect.bottom, TRUE); // 윈도우를 옮기는 루틴
return TRUE;
break;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDOK:
LineIDGen(hWnd);
EndDialog(hWnd, IDOK);
return TRUE;
case IDCANCEL:
EndDialog(hWnd, IDCANCEL);
return TRUE;
}
break;
case WM_CLOSE:
EndDialog(hWnd, 0);
return FALSE;
default:
return FALSE;
}
return TRUE;
}