static void ShowPageInfo() { SetWndText(hDlg, IDC_CELL_NAME, g_CfgData.szCellName); SetWndText(hDlg, IDC_SERVER_PW, g_CfgData.szServerPW); SetWndText(hDlg, IDC_VERIFY_PW, g_CfgData.szServerPW); if (g_CfgData.bFirstServer) SetCheck(hDlg, IDC_FIRST_SERVER); else SetCheck(hDlg, IDC_JOIN_EXISTING_CELL); }
static void CheckEnableSc() { BOOL bSccEnable = TRUE; UINT uiSccStatusMsg; UINT uiSccActionMsg; BOOL bScsEnable = TRUE; UINT uiScsStatusMsg; UINT uiScsActionMsg; // Disable SCS and SCC? if (!bFsOn && !bDbOn) { bScsEnable = FALSE; uiScsStatusMsg = IDS_SC_DISABLED; uiScsActionMsg = IDS_SC_ENABLE; bSccEnable = FALSE; uiSccStatusMsg = IDS_SC_DISABLED; uiSccActionMsg = IDS_SC_ENABLE; // Disable SCS? } else if (bSccOn) { bScsEnable = FALSE; uiScsStatusMsg = IDS_SC_DISABLED; uiScsActionMsg = IDS_SCS_ENABLE; // Disable SCC } else if (bScsOn) { bSccEnable = FALSE; uiSccStatusMsg = IDS_SC_DISABLED; uiSccActionMsg = IDS_SCC_ENABLE; } // Enable the sc server GUI if (bScsEnable) { SetEnable(hDlg, IDC_SCS, ES_ENABLE); SetCheck(hDlg, IDC_SCS, bScsOn); } else { // Disable the sc server gui SetEnable(hDlg, IDC_SCS, ES_DISABLE); SetCheck(hDlg, IDC_SCS, FALSE); SetWndText(hDlg, IDC_SCS_STATUS_MSG, uiScsStatusMsg); SetWndText(hDlg, IDC_SCS_ACTION_MSG, uiScsActionMsg); } // Enable the sc client GUI if (bSccEnable) { SetEnable(hDlg, IDC_SCC, ES_ENABLE); SetCheck(hDlg, IDC_SCC, bSccOn); EnableScMachine(bSccOn); } else { // Disable the sc client gui SetEnable(hDlg, IDC_SCC, ES_DISABLE); SetCheck(hDlg, IDC_SCC, FALSE); SetWndText(hDlg, IDC_SCC_STATUS_MSG, uiSccStatusMsg); SetWndText(hDlg, IDC_SCC_ACTION_MSG, uiSccActionMsg); EnableScMachine(FALSE); } }
static void CheckEnableBak() { // Enable/disable bk service based on db service. if (!bDbOn) { SetCheck(hDlg, IDC_BK_SERVICE, FALSE); SetEnable(hDlg, IDC_BK_SERVICE, ES_DISABLE); SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_DISABLED); SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_ENABLE); } else { SetCheck(hDlg, IDC_BK_SERVICE, bBakOn); SetEnable(hDlg, IDC_BK_SERVICE, ES_ENABLE); } }
static void OnListSelection(LPFLN_ITEMSELECT_PARAMS pItemParms) { ASSERT(pItemParms); hSelectedItem = 0; if (pItemParms->hItem) { LPARAM lParam = FastList_GetItemParam(hDriveList, pItemParms->hItem); if (lParam == 0) { hSelectedItem = pItemParms->hItem; if (bAutoSetPartitionName) { LPCTSTR pDrive = FastList_GetItemText(hDriveList, hSelectedItem, 0); g_CfgData.szPartitionName[0] = _totlower(pDrive[0]); g_CfgData.szPartitionName[1] = 0; SetWndText(hDlg, IDC_PARTITION_NAME, g_CfgData.szPartitionName); // Must set this to true because the call to SetWndText will cause // a call to OnPartitionName, which would incorrectly think that the // Partition Name had been set by the user rather than by us, thus // setting bAutoSetPartitionName to false. bAutoSetPartitionName = TRUE; } } } CheckEnableButtons(); }
void SetWndText(HWND hDlg, UINT uiCtrlID, UINT nMsgID) { TCHAR szMsg[cchRESOURCE]; GetString(szMsg, nMsgID); SetWndText(hDlg, uiCtrlID, szMsg); }
/* * Event Handler Functions _________________________________________________________________ * */ static void OnInitDialog(HWND hwndDlg) { hDlg = hwndDlg; g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON); g_pWiz->SetButtonText(IDNEXT, IDS_NEXT); g_pWiz->SetDefaultControl(IDNEXT); if (g_CfgData.bFirstServer) { ShowStatusMsg(IDS_MUST_CREATE_ROOT_AFS); g_CfgData.configRootVolumes = CS_CONFIGURE; return; } if (g_CfgData.configRootVolumes == CS_ALREADY_CONFIGURED) { ShowStatusMsg(IDS_ROOT_AFS_ALREADY_EXISTS); return; } // If the existence of the root volumes could not be determined, we'll // ask the user if they want to create them if they don't already exist. if (!g_CfgData.bRootVolumesExistanceKnown) { SetWndText(hDlg, IDC_ROOT_AFS_QUESTION, IDS_CREATE_ROOT_VOLUMES_IF_NECESSARY_PROMPT); SetCheck(hDlg, IDC_CREATE_ROOT_VOLUMES); g_CfgData.configRootVolumes = CS_CONFIGURE; return; } // Should this step be disabled? Yes, if this machine does // not have a partition to make root.afs on. if (!ConfiguredOrConfiguring(g_CfgData.configPartition)) { ShowStatusMsg(IDS_NO_PARTITION_EXISTS); EnableStep(g_CfgData.configRootVolumes, FALSE); return; } // If root.afs exists already but root.cell does not exist, then // the wizard cannot make root.cell and must disable this option. // However, since the root volumes don't both exist, we will leave // this option enabled, and only disable the yes check box. // TODO: We should handle this better in a future version where we can // add new messages. The message catalog is frozen for this version // so we have to handle this case without adding new messages. if (g_CfgData.bRootAfsExists && !g_CfgData.bRootCellExists) { EnableWnd(hDlg, IDC_CREATE_ROOT_VOLUMES, FALSE); SetCheck(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES); g_CfgData.configRootVolumes = CS_DONT_CONFIGURE; return; } // Must do this in case it was disabled on the last run through EnableStep(g_CfgData.configRootVolumes); if (g_CfgData.configRootVolumes == CS_DONT_CONFIGURE) SetCheck(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES); else SetCheck(hDlg, IDC_CREATE_ROOT_VOLUMES); }
static void EnableScMachine(BOOL bEnable) { SetEnable(hDlg, IDC_SC_MACHINE_LABEL, (ENABLE_STATE)bEnable); SetEnable(hDlg, IDC_SC_MACHINE, (ENABLE_STATE)bEnable); bSettingScMachine = TRUE; SetWndText(hDlg, IDC_SC_MACHINE, bEnable ? szScMachine : TEXT("")); bSettingScMachine = FALSE; }
static void MustMakePartition() { TCHAR szMsg[cchRESOURCE]; GetString(szMsg, IDS_MUST_MAKE_PARTITION); ShowWnd(hDlg, IDC_CREATE_PARTITION, FALSE); ShowWnd(hDlg, IDC_DONT_CREATE_PARTITION, FALSE); SetWndText(hDlg, IDC_ASK_CREATE_PARTITION, szMsg); }
/* * Utility Functions _________________________________________________________________ * */ static void ConfigMsg(UINT nMsgID) { TCHAR szMsg[cchRESOURCE]; GetString(szMsg, nMsgID); // Hide the controls that are at the same position as the message ShowWnd(hDlg, IDC_CREATE_FS_QUESTION, FALSE); ShowWnd(hDlg, IDC_SHOULD_CONFIG_FILE_SERVER, FALSE); ShowWnd(hDlg, IDC_DONT_CONFIG_FILE_SERVER, FALSE); SetWndText(hDlg, IDC_MSG, szMsg); ShowWnd(hDlg, IDC_MSG); }
/* * Utility Functions _________________________________________________________________ * */ static void ShowStatusMsg(UINT nMsgID) { TCHAR szMsg[cchRESOURCE]; GetString(szMsg, nMsgID); // Hide the controls that are at the same position as the message ShowWnd(hDlg, IDC_ROOT_AFS_QUESTION, FALSE); ShowWnd(hDlg, IDC_CREATE_ROOT_VOLUMES, FALSE); ShowWnd(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES, FALSE); SetWndText(hDlg, IDC_ROOT_AFS_MSG, szMsg); ShowWnd(hDlg, IDC_ROOT_AFS_MSG); }
void FrameForClient::InitInstance(){//Initialize Window /* //only use in In InitInstance(); BOOL SetWndText(LPWSTR title); if title = DEFAULT ,the title of window is default title BOOL SetSleepTime(UINT time); if time = DEFAULT , the sleep time is 10 ms BOOL SetWndSize(UINT width, UINT height); //if width(height) = DEFAULT , the width(height) will be default size BOOL SetAppIcon(UINT icon, UINT smicon); //if icon(smlicon) = DEFAULT , the icon(smlicon) will be default icon */ //To do something... SetAppIcon(IDI_ICON_BIRD,IDI_ICON_BIRD); SetWndText(_T(L"flappy bird")); SetWndSize(304, /*551*/510); SetSleepTime(20); }
static void OnAdvanced() { static int nOffset = 0; bAdvanced = !bAdvanced; ShowAndEnable(hDlg, IDC_ADVANCED_FRAME, bAdvanced); ShowAndEnable(hDlg, IDC_LOG_FILE, bAdvanced); ShowAndEnable(hDlg, IDC_LOG_FILE_LABEL, bAdvanced); ShowAndEnable(hDlg, IDC_NUM_PROCESSES, bAdvanced); ShowAndEnable(hDlg, IDC_TEMP_DIR, bAdvanced); ShowAndEnable(hDlg, IDC_TEMP_DIR_LABEL, bAdvanced); ShowAndEnable(hDlg, IDC_NUM_PROCESSES_CHECKBOX, bAdvanced); ShowAndEnable(hDlg, IDC_DAMAGED_VOLUMES, bAdvanced); ShowAndEnable(hDlg, IDC_SMALL_BLOCK_READS, bAdvanced); ShowAndEnable(hDlg, IDC_FORCE_SALVAGE, bAdvanced); ShowAndEnable(hDlg, IDC_FORCE_REBUILD, bAdvanced); ShowAndEnable(hDlg, IDC_LIST_DAMAGED_INODES, bAdvanced); ShowAndEnable(hDlg, IDC_LIST_OWNED_INDOES, bAdvanced); // To show or hide the advanced section, we have to resize the dialog // Get current position of the dialog RECT rectDlg; GetWindowRect(hDlg, &rectDlg); // Figure out offset between full dialog and short dialog if (nOffset == 0) { // Find the frame containing the things we will hide or show HWND hFrame = GetDlgItem(hDlg, IDC_ADVANCED_FRAME); // Get its dimensions RECT rectFrame; GetWindowRect(hFrame, &rectFrame); // Find the distance between the bottom of the dialog and the top of the frame nOffset = rectDlg.bottom - rectFrame.top - 3; } int nCurOffset = nOffset; if (!bAdvanced) nCurOffset *= -1; // Adjust dialog position MoveWindow(hDlg, rectDlg.left, rectDlg.top, rectDlg.right - rectDlg.left, rectDlg.bottom - rectDlg.top + nCurOffset, TRUE); SetWndText(hDlg, IDC_ADVANCED, bAdvanced ? IDS_ADVANCED_OPEN : IDS_ADVANCED_CLOSED); }
/* * Event Handler Functions _________________________________________________________________ * */ static void OnInitDialog(HWND hwndDlg) { hDlg = hwndDlg; bAdvanced = TRUE; TCHAR szNumProcesses[32]; _itot(DEFAULT_NUM_PROCESSES, szNumProcesses, 10); SetWndText(hDlg, IDC_NUM_PROCESSES, szNumProcesses); SetCheck(hDlg, IDC_NUM_PROCESSES_CHECKBOX); SetWndText(hDlg, IDC_LOG_FILE, A2S(DEFAULT_LOG_FILE)); // If a partition name isn't selected, then only allow the salvage server option if (szPartitionName[0] == 0) { SetEnable(hDlg, IDC_PARTITION, ES_DISABLE); SetEnable(hDlg, IDC_VOLUME, ES_DISABLE); SetCheck(hDlg, IDC_SERVER); } else SetCheck(hDlg, IDC_PARTITION); // Close the Advanced portion of the dialog OnAdvanced(); }
static void ConfigMsg(UINT nMsgID) { TCHAR szMsg[cchRESOURCE]; GetString(szMsg, nMsgID); // Hide the controls that are at the same position as the message ShowWnd(hDlg, IDC_DB_SERVER_QUESTION, FALSE); ShowWnd(hDlg, IDC_CONFIG_DB_SERVER, FALSE); ShowWnd(hDlg, IDC_SCM_PROMPT, FALSE); ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE_LABEL, FALSE); ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE, FALSE); ShowWnd(hDlg, IDC_DONT_CONFIG_DB_SERVER, FALSE); SetWndText(hDlg, IDC_MSG, szMsg); ShowWnd(hDlg, IDC_MSG); }
void SQRWndOffSet::OnProcess() { if ( 0 != mBeginTimer ) { DWORD time = static_cast<DWORD>(GetProcessTime()); if ( time - mBeginTimer > mSteptimer) { mBeginTimer = time; mStepResult += mStep; //显示的数据已经完毕了 if ( mStepResult > mStepOver ) { //暂时不实现,因为在设置字符串的时候需要一些代码修改 //mBeginTimer = 0; //ShowWnd(false); SetWndText(""); } } } }
static void ShowPartitionInfo() { // The SetWndText call below will mess up our bAutoSetPartitionName variable. // It will trigger the change event on the partition name field causing our // OnPartitionName function to get called, and making it look to us like the // user set the partition name. Therefore, we will save the current value, // make the call, then restore the value. BOOL bAutoSet = bAutoSetPartitionName; SetWndText(hDlg, IDC_PARTITION_NAME, g_CfgData.szPartitionName); bAutoSetPartitionName = bAutoSet; if (g_CfgData.chDeviceName != 0) { HLISTITEM hItem = NULL; while ((hItem = FastList_FindNext(hDriveList, hItem)) != NULL) { LPCTSTR pDrive = FastList_GetItemText(hDriveList, hItem, 0); if (pDrive[0] == g_CfgData.chDeviceName) { FastList_SelectItem(hDriveList, hItem, TRUE); hSelectedItem = hItem; break; } } } }
static void ShowServiceStates() { // FS if (bFsOn) { if (bFsRunning) SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_HOW_TO_STOP); else SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_WILL_RUN); } else { if (bFsRunning) SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_WILL_STOP); else SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_HOW_TO_RUN); } // DB switch (GetButtonState(hDlg, IDC_DB_SERVICE)) { case BST_CHECKED: if (bDbRunning) SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_HOW_TO_STOP); else SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_WILL_RUN); break; case BST_UNCHECKED: if (bDbRunning) SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_WILL_STOP); else SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_HOW_TO_RUN); break; case BST_INDETERMINATE: SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_DETAILS); break; } // For the ones below, in addition to setting the action message, we also // set the status message. This is because the status can change to the // disabled state depending on how other servers are configured. The // servers before this cannot have their status change except by re- // configuring them. // BK if (bDbOn) { if (IsButtonChecked(hDlg, IDC_BK_SERVICE)) { if (bBakRunning) { SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_RUNNING); SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_HOW_TO_STOP); } else { SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_STOPPED); SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_WILL_RUN); } } else { if (bBakRunning) { SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_RUNNING); SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_WILL_STOP); } else { SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_STOPPED); SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_HOW_TO_RUN); } } } CheckEnableBak(); // SC Server if (bFsOn || bDbOn && !bSccOn) { if (bScsOn) { if (bScsRunning) { SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_RUNNING); SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_HOW_TO_STOP); } else { SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_STOPPED); SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_WILL_RUN); } } else { if (bScsRunning) { SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_RUNNING); SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_WILL_STOP); } else { SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_STOPPED); SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_HOW_TO_RUN); } } } // SC Client if (bFsOn || bDbOn && !bScsOn) { if (bSccOn) { if (bSccRunning) { SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_RUNNING); SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_HOW_TO_STOP); } else { SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_STOPPED); SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_WILL_RUN); } } else { if (bSccRunning) { SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_RUNNING); SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_WILL_STOP); } else { SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_STOPPED); SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_HOW_TO_RUN); } } } CheckEnableSc(); }
static void ShowInitialConfig() { // FS bFsRunning = Configured(g_CfgData.configFS); if (bFsRunning) { SetCheck(hDlg, IDC_FS_SERVICE); SetWndText(hDlg, IDC_FS_STATUS_MSG, IDS_FS_RUNNING); SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_HOW_TO_STOP); } else { SetCheck(hDlg, IDC_FS_SERVICE, FALSE); SetWndText(hDlg, IDC_FS_STATUS_MSG, IDS_FS_STOPPED); SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_HOW_TO_RUN); } bFsOn = bFsRunning; // DB Set2State(hDlg, IDC_DB_SERVICE); bDbRunning = Configured(g_CfgData.configDB); if (bDbRunning) { SetCheck(hDlg, IDC_DB_SERVICE); SetWndText(hDlg, IDC_DB_STATUS_MSG, IDS_DB_RUNNING); SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_HOW_TO_STOP); } else if (bDbParial) { SetCheck(hDlg, IDC_DB_SERVICE, BST_INDETERMINATE); SetWndText(hDlg, IDC_DB_STATUS_MSG, IDS_DB_PARTIAL_CONFIG); SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_DETAILS); ShowWnd(hDlg, IDC_DB_DETAILS); Set3State(hDlg, IDC_DB_SERVICE); } else { SetCheck(hDlg, IDC_DB_SERVICE, FALSE); SetWndText(hDlg, IDC_DB_STATUS_MSG, IDS_DB_STOPPED); SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_HOW_TO_RUN); } bDbOn = bDbRunning; // BK bBakRunning = Configured(g_CfgData.configBak); SetEnable(hDlg, IDC_BK_SERVICE, ES_ENABLE); if (bBakRunning) { SetCheck(hDlg, IDC_BK_SERVICE); SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_RUNNING); SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_HOW_TO_STOP); } else { SetCheck(hDlg, IDC_BK_SERVICE, FALSE); SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_STOPPED); SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_HOW_TO_RUN); } bBakOn = bBakRunning; // SC Server bScsRunning = Configured(g_CfgData.configSCS); SetEnable(hDlg, IDC_SCS, ES_ENABLE); if (bScsRunning) { SetCheck(hDlg, IDC_SCS); SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_HOW_TO_STOP); } else { SetCheck(hDlg, IDC_SCS, FALSE); SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_STOPPED); SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_HOW_TO_RUN); } bScsOn = bScsRunning; // SC Client bSccRunning = Configured(g_CfgData.configSCC); SetEnable(hDlg, IDC_SCC, ES_ENABLE); if (bSccRunning) { SetCheck(hDlg, IDC_SCC); SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_HOW_TO_STOP); EnableScMachine(); lstrcpy(szScMachine, g_CfgData.szSysControlMachine); } else { SetCheck(hDlg, IDC_SCC, FALSE); SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_STOPPED); SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_HOW_TO_RUN); EnableScMachine(FALSE); } bSccOn = bSccRunning; }
static void ShowPageInfo() { SetWndText(hDlg, IDC_SYS_CONTROL_MACHINE, g_CfgData.szSysControlMachine); }