动态增加菜单后,需要将对话框的大小进行调整。
RECT rtWindow;
::GetWindowRect(hwndDlg, &rtWindow);
::ClientToScreen(hwndDlg, (LPPOINT)&rtWindow);
::ClientToScreen(hwndDlg, ((LPPOINT)&rtWindow) + 1);
// update the size of the owner
rtWindow.bottom += GetSystemMetrics(SM_CXMENUSIZE);;
SetWindowPos(hwndDlg, NULL, rtWindow.left, rtWindow.top, rtWindow.right - rtWindow.left, rtWindow.bottom - rtWindow.top, SWP_NOMOVE | SWP_NOZORDER);
SetMenu(hwndDlg, LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_MENU_MINI_MODE)));