Code:
case WM_COMMAND:
switch(LOWORD(wParam)) {
case TOOLBAR_UPDATE:
{
char editItem[BUFFER_SIZE];
SendDlgItemMessage(hwndToolbar,
ID_TOOLBAR_EDIT,
EM_GETLINE,
(WPARAM) 0, // line 0
(LPARAM) editItem);
int maxIdleTime = atoi(editItem);
updateUsers(maxIdleTime);
}
break;
case MAIN_FILE_CLOSE:
hideWindow(hwnd);
break;
case SWM_CONF:
case MAIN_EDIT_CONF:
DialogBox(NULL, MAKEINTRESOURCE(DIALOG_CONFIG), hwnd, ConfigDlgProc);
break;
case MAIN_HELP_about:
DialogBox(NULL, MAKEINTRESOURCE(DIALOG_ABOUT), hwnd, AboutDlgProc);
break;
case SWM_SHOW:
showWindow(hwnd);
break;
case SWM_HIDE:
hideWindow(hwnd);
break;
case SWM_RECON:
checkOnError();
break;
case SWM_EXIT:
WSACleanup();
destroyWindow(hwnd);
break;
}
/* Whoops, we need a break statement here. Otherwise, we fall through to
* the WM_SIZE with garbage values. */
case WM_SIZE:
SendMessage(hwndToolbar, TB_AUTOSIZE, 0, 0);
MoveWindow(hwndList,0,30,LOWORD(lParam),HIWORD(lPa ram),TRUE);
SendMessage(hwndList,LVM_ARRANGE,LVA_ALIGNLEFT,0);
break;
Also, you need to take account of the toolbar height when you set the size of your list-view:
Code:
case WM_SIZE:
{
RECT ToolbarRect;
DWORD ToolbarHeight;
/* Auto-size the toolbar. */
SendMessage(hwndToolbar, TB_AUTOSIZE, 0, 0);
/* Get height of toolbar. */
GetWindowRect(hwndToolbar, &ToolbarRect);
ToolbarHeight = ToolbarRect.bottom - ToolbarRect.top;
/* Size the list-view, taking into account the toolbar height. */
MoveWindow(hwndList, 0, ToolbarHeight,
LOWORD(lParam), HIWORD(lParam) - ToolbarHeight, TRUE);
SendMessage(hwndList,LVM_ARRANGE,LVA_ALIGNLEFT,0);
break;
}