well you might remember me asking about this here before, I figured out a way to get it done without getting any abnormal looking listview control (it got resized, but there parts of edge lines left from its old alignment, its hard to explain but it was just really weird).
Ken Fitlike suggested just sending the WM_SIZE message to hwndStatBar, however when I tried that I got one of those listview control abnormalities. I've attached a screenshot, since they are so hard to explain, you'll notice the blue line on the right side of the listview. that will appear when I:
1. Execute the program, the dialog opens up in its default size.
2. I minimize the dialog.
3. I click the dialog in the task bar (to restore it).
4. I maximize the dialog.
using Ken's idea, which is a bug in my eyes. my remedy was my original code:
Code:
case WM_SIZE:
/* Handle maximizing/minimizing of the dialog box by appropriately resizing its controls. */
GetClientRect(hWnd, &rect);
MoveWindow(hwndList, rect.left, rect.top, LOWORD(lParam), HIWORD(lParam), FALSE);
MoveWindow(hwndStatBar, rect.left, rect.top, LOWORD(lParam), HIWORD(lParam), FALSE);
return TRUE;
which fixed the problem of that weird line, no matter how I minimize/restore/maximize the dialog. however I was just doing some serious testing when I ran into another problem.
you'll notice in the screenshot I've attached that you can see the status bar. that shouldn't be, when I took the screenshot I chose to select a specific window, and I could not target the listview control window without including the status bar.
Code:
case WM_NOTIFY:
/* Only handle WM_NOTIFY messages from the main listview control. */
if(((LPNMHDR)lParam)->hwndFrom == hwndList) {
switch(((LPNMHDR)lParam)->code) {
case NM_DBLCLK:
case NM_RCLICK:
/* some code to create a popup menu follows here, which is even executed if the message is coming from hwndStatBar */
the check to make sure that the message is coming from hwndList fails when the message arrives from the status bar, execution follows through to the switch(), which should not be happening, I don't want to handle any messages from the status bar.
this tells me that something undesired is likely happening with the way I'm handling WM_SIZE, as this will only occur after that message has been recieved (after the window has been minimized/maximized/restored). I'm guessing my call to MoveWindow() is to blame, I'd assume that somehow the listview control window is overlapping the status bar, probably as a result of wrong coordinates passed to MoveWindow().
does anyone know how I could resolve this? I'm obviously not very good with this rect/dimensional stuff. any help here would be greatly appreciated.
thank you in advance.