我一直在寻找一段时间,我找不到我想要的答案或风格。
http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600(v=vs.85).aspx
允许我的窗口可调整大小的标志是什么。
我现在有这个:
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style= CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc= (WNDPROC)WndProc;
wcex.cbClsExtra= 0;
wcex.cbWndExtra= 0;
wcex.hInstance= hInstance;
wcex.hIcon= 0;
wcex.hCursor= LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground= (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName= 0;
wcex.lpszClassName= "bla";
wcex.hIconSm= 0;
HWND hWnd = CreateWindow(
"bla",
"bla",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
和我的Proc是:
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_SIZE:
screenServer.OnScreenResize( LOWORD(lParam), HIWORD(lParam) );
break;
case WM_NCHITTEST:
return HTCLIENT;
break;
case WM_MOUSEMOVE:
{
//SetCapture(hWnd);
// Retrieve mouse screen position
int x = ( short )LOWORD( lParam );
int y = ( short )HIWORD( lParam );
mouseServer.OnMouseMove( x, y );
//ReleaseCapture();
}
break;
case WM_RBUTTONDOWN:
mouseServer.OnRightMouseDown();
break;
case WM_RBUTTONUP:
mouseServer.OnRightMouseUp();
break;
case WM_LBUTTONDOWN:
mouseServer.OnLeftMouseDown();
break;
case WM_LBUTTONUP:
mouseServer.OnLeftMouseUp();
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
case WM_KEYDOWN:
{
//switch(wParam)
//{
// case 'ESC':
// // w key pressed
// break;
// default:
// break;
//}
}
default:
return DefWindowProc( hWnd, message, wParam, lParam );
}
return 0;
}
答案 0 :(得分:1)
根据http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v=vs.85%29.aspx
WS_SIZEBOX 0x00040000L
窗口有一个大小调整边框。与WS_THICKFRAME样式相同。
WS_THICKFRAME 0x00040000L
窗口有一个大小调整边框。与WS_SIZEBOX样式相同。
答案 1 :(得分:0)
您要查找的窗体样式为WS_THICKFRAME
。请注意,WS_OVERLAPPEDWINDOW
包含WS_THICKFRAME
,因此您的窗口已经很大。
WM_NCHITTEST
的窗口过程处理正在阻止调整大小的工作。从switch语句中删除该大小写,调整大小应该再次开始工作。