case WM_SIZE: if (wParam == SIZE_MAXIMIZED) force_normal(hwnd); return 0;
static int GenericMainDlgProc (HWND hwnd, UINT msg,			       WPARAM wParam, LPARAM lParam,			       int npanels, int *panelnums, HWND *page) {    HWND hw;    switch (msg) {      case WM_INITDIALOG:	{			       /* centre the window */	    RECT rs, rd;	    hw = GetDesktopWindow();	    if (GetWindowRect (hw, &rs) && GetWindowRect (hwnd, &rd))		MoveWindow (hwnd, (rs.right + rs.left + rd.left - rd.right)/2,			    (rs.bottom + rs.top + rd.top - rd.bottom)/2,			    rd.right-rd.left, rd.bottom-rd.top, TRUE);	}	*page = NULL;	{			       /* initialise the tab control */	    TC_ITEMHEADER tab;	    int i;	    hw = GetDlgItem (hwnd, IDC_TAB);	    for (i=0; i<npanels; i++) {		tab.mask = TCIF_TEXT;		tab.pszText = names[panelnums[i]];		TabCtrl_InsertItem (hw, i, &tab);	    }/*	    *page = CreateDialogIndirect (hinst, panels[panelnums[0]].temp,					  hwnd, panelproc[panelnums[0]]);*/	    *page = CreateDialog (hinst, panelids[panelnums[0]],				  hwnd, panelproc[panelnums[0]]);	    SetWindowLong (*page, GWL_EXSTYLE,			   GetWindowLong (*page, GWL_EXSTYLE) |			   WS_EX_CONTROLPARENT);	}	SetFocus (*page);	return 0;      case WM_NOTIFY:	if (LOWORD(wParam) == IDC_TAB &&	    ((LPNMHDR)lParam)->code == TCN_SELCHANGE) {	    int i = TabCtrl_GetCurSel(((LPNMHDR)lParam)->hwndFrom);	    if (*page)		DestroyWindow (*page);/*	    *page = CreateDialogIndirect (hinst, panels[panelnums[i]].temp,						  hwnd, panelproc[panelnums[i]]);*/	    *page = CreateDialog (hinst, panelids[panelnums[i]],				  hwnd, panelproc[panelnums[i]]);	    SetWindowLong (*page, GWL_EXSTYLE,			   GetWindowLong (*page, GWL_EXSTYLE) |			   WS_EX_CONTROLPARENT);	    SetFocus (((LPNMHDR)lParam)->hwndFrom);   /* ensure focus stays */	    return 0;	}	break;/*      case WM_CTLCOLORDLG: *//*	return (int) GetStockObject (LTGRAY_BRUSH); */      case WM_COMMAND:	switch (LOWORD(wParam)) {	  case IDOK:	    if (*cfg.host)		EndDialog (hwnd, 1);	    else		MessageBeep (0);	    return 0;	  case IDCANCEL:	    EndDialog (hwnd, 0);	    return 0;	}	return 0;      case WM_CLOSE:	EndDialog (hwnd, 0);	return 0;    }    return 0;}