static void UpdateControls() { // Update volume name controls BOOL bVolume = IsButtonChecked(hDlg, IDC_VOLUME); ENABLE_STATE es = bVolume ? ES_ENABLE : ES_DISABLE; SetEnable(hDlg, IDC_VOLUME_NAME, es); SetEnable(hDlg, IDC_VOLUME_NAME_LABEL, es); GetWndText(hDlg, IDC_VOLUME_NAME, szVolumeName); // Num processes edit control BOOL bParallel = IsButtonChecked(hDlg, IDC_NUM_PROCESSES_CHECKBOX); SetEnable(hDlg, IDC_NUM_PROCESSES, (ENABLE_STATE)bParallel); GetWndText(hDlg, IDC_NUM_PROCESSES, szNumProcesses, NUM_PROCS_BUF_SIZE); GetWndText(hDlg, IDC_LOG_FILE, g_CfgData.szSalvageLogFileName, _MAX_PATH); GetWndText(hDlg, IDC_TEMP_DIR, szTempDir, _MAX_PATH); // Should OK button be enabled or disabled? BOOL bEnable = TRUE; if (bVolume) bEnable = !!lstrlen(szVolumeName); if (bEnable && bParallel) bEnable = !!lstrlen(szNumProcesses); SetEnable(hDlg, IDOK, (ENABLE_STATE)bEnable); }
static BOOL SavePageInfo() { TCHAR szText[cchRESOURCE]; GetWndText(hDlg, IDC_CELL_NAME, szText); if (lstrlen(szText) > MAX_CELL_NAME_LEN) { MsgBox(hDlg, IDS_CELL_NAME_LEN_ERROR, GetAppTitleID(), MB_ICONSTOP | MB_OK); return FALSE; } lstrcpy(g_CfgData.szCellName, szText); lstrncpy(g_CfgData.szServerPW, GetWndText(hDlg, IDC_SERVER_PW, szText), MAX_SERVER_PW_LEN); g_CfgData.bFirstServer = IsButtonChecked(hDlg, IDC_FIRST_SERVER); return TRUE; }
void HyperLink::FitWindow() { std::wstring text = unicode_utils::utf8_to_utf16(GetWndText(hwnd), NULL); RECT rect; ::GetWindowRect(hwnd, &rect); ScreenToClient(parent, &rect); HDC hdc = ::GetDC(hwnd); HGDIOBJ oldFont = ::SelectObject(hdc, underlineFont); SIZE extent; ::GetTextExtentPoint32(hdc, text.c_str(), text.length(), &extent); ::SelectObject(hdc, oldFont); ::ReleaseDC(hwnd, hdc); //free(text); int x = rect.left; int y = rect.top; int w = extent.cx; int h = extent.cy; DWORD style = ::GetWindowLong(hwnd, GWL_STYLE); if (style & SS_CENTER) // remain centered x -= (w - (rect.right - rect.left)) / 2; else if (style & SS_RIGHT) x -= w - (rect.right - rect.left); ::SetWindowPos(hwnd, NULL, x, y, w, h, SWP_NOZORDER | SWP_NOACTIVATE); }
/* * Utility Functions _________________________________________________________________ * */ static void CheckEnableButtons() { BOOL bDisable = FALSE; TCHAR szCellName[cchRESOURCE]; TCHAR szPW[cchRESOURCE]; TCHAR szVerifyPW[cchRESOURCE]; bDisable = lstrlen(GetWndText(hDlg, IDC_CELL_NAME, szCellName)) == 0; GetWndText(hDlg, IDC_SERVER_PW, szPW); GetWndText(hDlg, IDC_VERIFY_PW, szVerifyPW); if (IsButtonChecked(hDlg, IDC_FIRST_SERVER)) bDisable |= !lstrlen(szPW) || !lstrlen(szVerifyPW) || lstrcmp(szPW, szVerifyPW); if (bDisable) g_pWiz->EnableButtons(BACK_BUTTON); else g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON); }
static void OnScMachineChange() { if (!bSettingScMachine && IsButtonChecked(hDlg, IDC_SCC)) GetWndText(hDlg, IDC_SC_MACHINE, szScMachine, sizeof(szScMachine) / sizeof(szScMachine[0])); }
static void SavePageInfo() { GetWndText(hDlg, IDC_SYS_CONTROL_MACHINE, g_CfgData.szSysControlMachine); }