我一直在寻找一段时间,但我找不到我正在寻找的答案或风格。
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);
我的过程是:
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;
}