0
我想在MDI MainWindow內創建子窗口...主窗口的大小爲1024 x 768 ...當我嘗試使用CreateWindowEx()創建子窗口時,大小似乎以某種方式抵消......換句話說,一個1024 x 768的子窗口比它的父窗口小...我怎麼解釋這種差異?當我在主窗口的句柄中使用GetCLientRect()...時,尺寸仍然更小......我不介意讓子窗口的大小相同。我希望子窗口包含750x563圖像的確切大小。當我設置CreateWindowEx()的參數範圍內的大小,子窗口太小...MDI子窗口大小
下面是我用MainWndProc內創建一個子窗口中的代碼:
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT Msg,
WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
switch(Msg)
{
case WM_CREATE:
{
//OnCreate(hWnd, NULL);
CLIENTCREATESTRUCT ccs;
ccs.hWindowMenu = GetSubMenu(GetMenu(hWnd), 2);
ccs.idFirstChild = StartChildrenNo;
hWndChildFrame = CreateWindowEx(WS_EX_CLIENTEDGE,
L"MDICLIENT",
NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL
| WS_HSCROLL | WS_VISIBLE,
0,
0,
1024,
768,
hWnd,
(HMENU)IDM_FILE_NEW,
GetModuleHandle(NULL),
(LPVOID)&ccs);
if(hWndChildFrame == NULL)
MessageBox(hWnd, L"Could not create MDI client.", L"Error", MB_OK | MB_ICONERROR);
CreateNewMDIChild(hWndChildFrame);
return 0;
}
.. 。 }