"Jonathan Wilson" jonwil@tpgi.com.au wrote:
+VOID DIALOG_ShowStatusBar(VOID) +{
- RECT rcs;
- RECT rc;
- GetClientRect(Globals.hMainWnd, &rc);
- Globals.bStatusBarEnabled = !Globals.bStatusBarEnabled;
- if (Globals.bStatusBarEnabled == TRUE)
- {
ShowWindow(Globals.hStatusBar,SW_SHOW);
GetClientRect(Globals.hStatusBar,&rcs);
Globals.iStatusBarHeight = rcs.bottom - rcs.top;
SendMessage(Globals.hStatusBar, WM_SIZE, 0, 0);
case WM_SIZE:
SetWindowPos(Globals.hEdit, NULL, 0, 0, LOWORD(lParam), HIWORD(lParam),
SetWindowPos(Globals.hEdit, NULL, 0, 0, LOWORD(lParam), (HIWORD(lParam)-Globals.iStatusBarHeight), SWP_NOOWNERZORDER | SWP_NOZORDER);
if (Globals.bStatusBarEnabled == TRUE)
{
SendMessage(Globals.hStatusBar, WM_SIZE, 0, 0);
}
Do not send bogus WM_SIZE messages, use SetWindowPos instead. Remove iStatusBarHeight from globals and use IsWindowVisible and GetWindowRect when you need to take into account status bar size.
Do not send bogus WM_SIZE messages, use SetWindowPos instead. Remove iStatusBarHeight from globals and use IsWindowVisible and GetWindowRect when you need to take into account status bar size.
From looking at microsoft examples, said examples send WM_SIZE to the status bar and let it reposition itself.
And also, said examples store the status bar height for later use (presumably because calling IsWindowVisible and GetWindowRect multiple times is slower than saving it and reusing it later)
I dont know if there is one example that does both things but I do know that both things are done by microsoft example code.
On July 27, 2003 11:34 pm, Jonathan Wilson wrote:
And also, said examples store the status bar height for later use (presumably because calling IsWindowVisible and GetWindowRect multiple times is slower than saving it and reusing it later)
I'd have to agree with Dmitry -- this looks like the sort of premature optimization that complicates things needlessly. I had the same gut reaction -- just use GetWindowRect when you need that info.
On Mon, 28 Jul 2003 13:34, Jonathan Wilson wrote:
From looking at microsoft examples, said examples send WM_SIZE to the status bar and let it reposition itself.
Microsoft examples also tend to be riddled with gotos. I wouldn't use "A Microsoft example did this" as justification for anything.
Troy Rollo wrote:
On Mon, 28 Jul 2003 13:34, Jonathan Wilson wrote:
From looking at microsoft examples, said examples send WM_SIZE to the status bar and let it reposition itself.
Microsoft examples also tend to be riddled with gotos. I wouldn't use "A Microsoft example did this" as justification for anything.
True. But allowing the status bar to resize itself means that it automaticly takes into acount things like the font its using for the text and stuff.
"Jonathan Wilson" jonwil@tpgi.com.au wrote:
From looking at microsoft examples, said examples send WM_SIZE to the status bar and let it reposition itself.
Microsoft examples also tend to be riddled with gotos. I wouldn't use "A Microsoft example did this" as justification for anything.
True. But allowing the status bar to resize itself means that it automaticly takes into acount things like the font its using for the text and stuff.
A possibility that status bar will change its size behind your back justifies the use of GetWindowRect.