/*--------------------------------------------------------------+ | statusWndProc - window proc for status window | +--------------------------------------------------------------*/ LRESULT CALLBACK statusWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; HWND hwndSText; switch(msg) { case WM_CREATE: { // The following code is correct for x64, but the /Wp64 switch doesn't think so. // Therefore, temporarily disable warning C4312. #pragma warning(push) #pragma warning(disable: 4312) /* we need to create the static text control for the status bar */ hwndSText = CreateWindow(szText, TEXT(""), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 0, 0, 0, 0, hwnd, (HMENU) 1, // child id GetWindowInstance(hwnd), // Returns (HMODULE)LONG_PTR NULL); #pragma warning(pop) if(!hwndSText) return -1; break; } case WM_DESTROY: statusDeleteTools(); break; case WM_SIZE: { RECT rc; GetClientRect(hwnd, &rc); MoveWindow(GetDlgItem(hwnd, 1), // get child window handle 2, 1, // xy just inside rc.right - 4, rc.bottom - 2, TRUE); break; } case WM_PAINT: { BeginPaint(hwnd, &ps); // only the background and the child window need painting EndPaint(hwnd, &ps); break; } case WM_SYSCOLORCHANGE: statusDeleteTools(); statusCreateTools(); break; case WM_ERASEBKGND: break; } return DefWindowProc(hwnd, msg, wParam, lParam); }
/*--------------------------------------------------------------+ | statusWndProc - window proc for status window | +--------------------------------------------------------------*/ LRESULT CALLBACK statusWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; HWND hwndSText; switch(msg) { case WM_CREATE: { /* we need to create the static text control for the status bar */ hwndSText = CreateWindow(szText, TEXT(""), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 0, 0, 0, 0, hwnd, (HMENU) 1, // child id GetWindowInstance(hwnd), NULL); if(!hwndSText) return -1; break; } case WM_DESTROY: statusDeleteTools(); break; case WM_SIZE: { RECT rc; GetClientRect(hwnd, &rc); MoveWindow(GetDlgItem(hwnd, 1), // get child window handle 2, 1, // xy just inside rc.right - 4, rc.bottom - 2, TRUE); break; } case WM_PAINT: { BeginPaint(hwnd, &ps); // only the background and the child window need painting EndPaint(hwnd, &ps); break; } case WM_SYSCOLORCHANGE: statusDeleteTools(); statusCreateTools(); break; case WM_ERASEBKGND: break; } return DefWindowProc(hwnd, msg, wParam, lParam); }