This is my window class definition:
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 = LoadIcon(hInstance, (LPCTSTR)IDI_GROUPBOX);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)GetStockObject(LTG
wcex.lpszMenuName = (LPCSTR)IDC_GROUPBOX;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
In the wndproc for the window I take the width and height from lParam:
case WM_SIZE:
{
gnWidth = LOWORD( lParam );
gnHeight = HIWORD( lParam );
InvalidateRect( hWnd, NULL, TRUE );
break;
}
I also did
RECT r;
GetClientRect( hWnd, &r );
but the size was exactly as that sent from Windows to my wndproc via lParam.
Oh, almost forgot:
case WM_PAINT:
{
hdc = BeginPaint(hWnd, &ps);
RECT rt;
TCHAR szSize[100];
_stprintf( szSize, _T("%dx%d"), gnWidth, gnHeight );
GetClientRect(hWnd, &rt);
DrawText(hdc, szSize, strlen(szSize), &rt, DT_CENTER);
EndPaint(hWnd, &ps);
break;
}
/rob
Main Topics
Browse All Topics





by: _Rob_Posted on 2003-09-29 at 10:44:16ID: 9453116
Could you post some snippets?
/rob