2012-04-06 26 views
0

這是如何創建窗口。但是當我使用GetClientRect時,rcClient比32x32大得多。如何在Windows上創建小窗口(32x32)?

int nDefaultWidth = 32; 
int nDefaultHeight = 32; 

UINT32 winStyle = 0; 

RECT rc; 
SetRect(&rc, 0, 0, nDefaultWidth, nDefaultHeight); 
AdjustWindowRect(&rc, winStyle, (hMenu != NULL) ? true : false); 


// Create the render window 
HWND hWnd = CreateWindow(L"Direct3DWindowClass", NULL, winStyle, 
          x, y, (rc.right - rc.left), (rc.bottom - rc.top), 0, 
          hMenu, hInstance, 0); 

RECT rcClient; 
GetClientRect(hWnd, &rcClient); 

回答

2

你傳入0dwStyle參數AdjustWindowRect。該值等於WS_OVERLAPPED,而AdjustWindowRect明確禁止您傳遞該特定值。

既然你想創建一個32×32窗口(即無鉻可言,純粹的客戶端區域),因爲它根本沒有任何意義,你應該失去AdjustWindowRect通話,並通過WS_POPUP的窗口風格CreateWindow

相關問題