typedefstruct tagMINMAXINFO{ POINT ptReserved;//保留 POINT ptMaxSize;//最大大小(窗口大小) POINT ptMaxPosition;//最大位置(即左上角到右下角的距离) POINT ptMinTrackSize;//限制的最小大小 POINT ptMaxTrackSize;//限制的最大大小} MINMAXINFO,*PMINMAXINFO,*LPMINMAXINFO;
代码:
LRESULT CALLBACKWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){switch(uMsg){case WM_GETMINMAXINFO:{DefWindowProcW(hwnd, uMsg, wParam, lParam);((MINMAXINFO*)lParam)->ptMinTrackSize=(POINT){400,300};//限制最小大小为400,300((MINMAXINFO*)lParam)->ptMaxTrackSize=(POINT){500,400};//限制最大大小return0;}case WM_PAINT:break;case WM_CLOSE:DestroyWindow(hwnd);//关闭窗口break;case WM_DESTROY:PostQuitMessage(0);//摧毁窗口break;}returnDefWindowProcW(hwnd, uMsg, wParam, lParam);}