HWND Main_CreateTabDialog (HWND hTab, size_t iTab) { HWND hDlg = NULL; LPTSTR psz = NULL; TC_ITEM Item; memset (&Item, 0x00, sizeof(Item)); Item.mask = TCIF_PARAM; if (TabCtrl_GetItem (hTab, iTab, &Item)) { psz = (LPTSTR)(Item.lParam); } if (psz == dwTABPARAM_ADVANCED) // Advanced tab { hDlg = ModelessDialog (IDD_TAB_ADVANCED, hTab, (DLGPROC)Advanced_DlgProc); } else if (psz == dwTABPARAM_MOUNT) // Mount Points tab { hDlg = ModelessDialog (IDD_TAB_MOUNT, hTab, (DLGPROC)Mount_DlgProc); } else if (ISCELLTAB(psz) && !*psz) // No Creds tab { hDlg = ModelessDialogParam (IDD_TAB_NOCREDS, hTab, (DLGPROC)Creds_DlgProc, (LPARAM)psz); } else if (ISCELLTAB(psz) && *psz) // Creds tab for a particular cell { hDlg = ModelessDialogParam (IDD_TAB_CREDS, hTab, (DLGPROC)Creds_DlgProc, (LPARAM)psz); } return hDlg; }
BOOL WIZARD::ShowBackground (BOOL fShow) { if (!fShow && m_hBkg && IsWindow (m_hBkg)) { DestroyWindow (m_hBkg); m_hBkg = NULL; } else if (fShow && !(m_hBkg && IsWindow (m_hBkg))) { if ((m_hBkg = ModelessDialogParam (m_iddBackground, NULL, (DLGPROC)WIZARD::Background_DlgProc, (LPARAM)this)) == NULL) return FALSE; RECT rDesktop; SystemParametersInfo (SPI_GETWORKAREA, 0, &rDesktop, 0); WINDOWPLACEMENT wpl; wpl.length = sizeof(wpl); wpl.flags = 0; wpl.showCmd = (GetWindowLong (m_hBkg, GWL_STYLE) & WS_MAXIMIZE) ? SW_SHOWMAXIMIZED : SW_SHOW; wpl.ptMinPosition.x = 0; wpl.ptMinPosition.y = 0; wpl.ptMaxPosition.x = 0; wpl.ptMaxPosition.y = 0; wpl.rcNormalPosition.left = rDesktop.left + cxLEFT_BACKGROUND; wpl.rcNormalPosition.right = rDesktop.right - cxRIGHT_BACKGROUND; wpl.rcNormalPosition.top = rDesktop.top + cyTOP_BACKGROUND; wpl.rcNormalPosition.bottom = rDesktop.bottom - cyBOTTOM_BACKGROUND; SetWindowPlacement (m_hBkg, &wpl); } return TRUE; }
void Server_SyncVLDB (LPIDENT lpi) { HWND hCurrent; if ((hCurrent = PropCache_Search (pcSVR_SYNCVLDB, lpi)) != NULL) { SetFocus (hCurrent); } else { ModelessDialogParam (IDD_SVR_SYNCVLDB, NULL, (DLGPROC)Server_SyncVLDB_DlgProc, (LPARAM)lpi); } }
void Filesets_Release (LPIDENT lpi) { HWND hCurrent; if ((hCurrent = PropCache_Search (pcSET_RELEASE, lpi)) != NULL) { SetFocus (hCurrent); } else { HWND hDlg = ModelessDialogParam (IDD_SET_RELEASE, NULL, (DLGPROC)Filesets_Release_DlgProc, (LPARAM)lpi); ShowWindow (hDlg, SW_SHOW); } }
void Server_Salvage (LPIDENT lpi) { HWND hCurrent; if ((hCurrent = PropCache_Search (pcSVR_SALVAGE, lpi)) != NULL) { SetFocus (hCurrent); } else { HWND hDlg = ModelessDialogParam (IDD_SVR_SALVAGE, NULL, (DLGPROC)Server_Salvage_DlgProc, (LPARAM)lpi); ShowWindow (hDlg, SW_SHOW); } }
void WIZARD::Refresh (DWORD dwRefFlags) { if (dwRefFlags & REFRESH_LEFT_PANE) { HWND hLHS; if ((hLHS = GetDlgItem (m_hWnd, m_idcLeftPane)) != NULL) { RECT rr; GetClientRect (hLHS, &rr); InvalidateRect (hLHS, &rr, TRUE); UpdateWindow (hLHS); } } if (dwRefFlags & REFRESH_RIGHT_PANE) { HWND hRHS; if ((hRHS = GetDlgItem (m_hWnd, m_idcRightPane)) != NULL) { HWND hOld = GetRightHandWindow(); LPWIZARD_STATE pState; if ((pState = FindState (m_stCurrent)) != NULL) { int stCurrent = m_stCurrent; HWND hNew; if ((hNew = ModelessDialogParam (pState->idd, m_hWnd, pState->dlgproc, pState->lp)) != NULL) { if (stCurrent != m_stCurrent) DestroyWindow (hNew); else { RECT rRHS; GetRectInParent (hRHS, &rRHS); SetWindowPos (hNew, NULL, rRHS.left, rRHS.top, cxRECT(rRHS), cyRECT(rRHS), SWP_NOZORDER | SWP_NOACTIVATE); SetWindowLong (hNew, GWL_ID, pState->idd); ShowWindow (hNew, SW_SHOW); ShowWindow (hRHS, SW_HIDE); } } } if (hOld != NULL) DestroyWindow (hOld); } } }
void Server_Uninstall (LPIDENT lpiServer) { HWND hCurrent; if ((hCurrent = PropCache_Search (pcSVR_UNINSTALL, NULL)) != NULL) { SetFocus (hCurrent); } else { LPSVR_UNINSTALL_PARAMS lpp = New (SVR_UNINSTALL_PARAMS); lpp->lpiServer = lpiServer; lpp->szUninstall[0] = TEXT('\0'); HWND hDlg = ModelessDialogParam (IDD_SVR_UNINSTALL, NULL, (DLGPROC)Server_Uninstall_DlgProc, (LPARAM)lpp); ShowWindow (hDlg, SW_SHOW); } }
BOOL WIZARD::Show (BOOL fShowReq) { if (m_fShowing && !fShowReq) { m_fShowing = FALSE; if (m_hWnd && IsWindow (m_hWnd)) DestroyWindow (m_hWnd); m_hWnd = NULL; } else if (!m_fShowing && fShowReq) { if (m_iddTemplate == -1) return FALSE; if (m_idcLeftPane == -1) return FALSE; if (m_idcRightPane == -1) return FALSE; if (m_idcBack == -1) return FALSE; if (m_idcNext == -1) return FALSE; if ((m_hWnd = ModelessDialogParam (m_iddTemplate, m_hBkg, (DLGPROC)WIZARD::Template_DlgProc, (LPARAM)this)) == NULL) return FALSE; m_fShowing = TRUE; MSG msg; while (GetMessage (&msg, 0, 0, NULL)) { if (!IsDialogMessage (m_hWnd, &msg)) { TranslateMessage (&msg); DispatchMessage (&msg); } if (!m_fShowing || !m_hWnd || !IsWindow (m_hWnd)) break; } } return TRUE; }
void Server_Prune (LPIDENT lpiServer, BOOL fBAK, BOOL fOLD, BOOL fCore) { HWND hCurrent; if ((hCurrent = PropCache_Search (pcSVR_PRUNE, NULL)) != NULL) { SetFocus (hCurrent); } else { LPSVR_PRUNE_PARAMS lpp = New (SVR_PRUNE_PARAMS); lpp->lpiServer = lpiServer; lpp->fBAK = fBAK; lpp->fOLD = fOLD; lpp->fCore = fCore; HWND hDlg = ModelessDialogParam (IDD_SVR_PRUNE, NULL, (DLGPROC)Server_Prune_DlgProc, (LPARAM)lpp); ShowWindow (hDlg, SW_SHOW); } }
void Server_Open (LPIDENT lpiServer, LPRECT prWindow) { HWND hServer; if ((hServer = PropCache_Search (pcSERVER, lpiServer)) != NULL) { SetFocus (hServer); } else { // First off, if this server isn't being monitored, we have // to start monitoring it or we can't open a window (nothing to // show otherwise). // LPSERVER_PREF lpsp; if ((lpsp = (LPSERVER_PREF)lpiServer->GetUserParam()) != NULL) { BOOL fCanShowWindow = (gr.fOpenMonitors || lpsp->fIsMonitored); if (gr.fOpenMonitors && !lpsp->fIsMonitored) { StartTask (taskSVR_MONITOR_ONOFF, NULL, lpiServer); } if (fCanShowWindow) { hServer = ModelessDialogParam (IDD_SERVER, NULL, (DLGPROC)Server_DlgProc, (LPARAM)lpiServer); Server_SelectServer (hServer, lpiServer); if (prWindow->right != 0) { SetWindowPos (hServer, NULL, prWindow->left, prWindow->top, cxRECT(*prWindow), cyRECT(*prWindow), SWP_NOZORDER | SWP_NOACTIVATE); } ShowWindow (hServer, SW_NORMAL); } } } }
void Server_Salvage_OnOK (HWND hDlg) { // Prepare a taskSVR_SALVAGE packet // LPSVR_SALVAGE_PARAMS lpp = New (SVR_SALVAGE_PARAMS); memset (lpp, 0x00, sizeof(SVR_SALVAGE_PARAMS)); GetDlgItemText (hDlg, IDC_SALVAGE_TEMPDIR, lpp->szTempDir, MAX_PATH); GetDlgItemText (hDlg, IDC_SALVAGE_LOG_FILE, lpp->szLogFile, MAX_PATH); lpp->fForce = IsDlgButtonChecked (hDlg, IDC_SALVAGE_FORCE); lpp->fReadonly = IsDlgButtonChecked (hDlg, IDC_SALVAGE_READONLY); lpp->fLogInodes = IsDlgButtonChecked (hDlg, IDC_SALVAGE_LOG_INODES); lpp->fLogRootInodes = IsDlgButtonChecked (hDlg, IDC_SALVAGE_LOG_ROOT); lpp->fRebuildDirs = IsDlgButtonChecked (hDlg, IDC_SALVAGE_FIXDIRS); lpp->fReadBlocks = IsDlgButtonChecked (hDlg, IDC_SALVAGE_BLOCK); if (IsDlgButtonChecked (hDlg, IDC_SALVAGE_SIMUL)) lpp->nProcesses = (int)SP_GetPos (GetDlgItem (hDlg, IDC_SALVAGE_NUM)); lpp->lpiSalvage = NULL; if (!IsDlgButtonChecked (hDlg, IDC_FILESET_ALL)) lpp->lpiSalvage = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_FILESET)); if (!lpp->lpiSalvage && !IsDlgButtonChecked (hDlg, IDC_AGGREGATE_ALL)) lpp->lpiSalvage = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_AGGREGATE)); if (!lpp->lpiSalvage) // salvage the whole server lpp->lpiSalvage = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER)); if (!lpp->lpiSalvage) Delete (lpp); else { // Create (but don't show) a results dialog for this operation. // HWND hResults = ModelessDialogParam (IDD_SVR_SALVAGE_RESULTS, NULL, (DLGPROC)Server_Salvage_Results_DlgProc, (LPARAM)(lpp->lpiSalvage)); AfsAppLib_RegisterModelessDialog (hDlg); // Fire up the background task; when it finishes, have the task scheduler // send the result packet to that results dialog. // StartTask (taskSVR_SALVAGE, hResults, lpp); } }
HWND ModelessDialog (int idd, HWND hWndParent, DLGPROC lpDialogFunc) { return ModelessDialogParam (idd, hWndParent, lpDialogFunc, 0); }