// PowerPage.cpp : implementation file // #include "stdafx.h" #include "afxpriv.h" // afxpriv.h has WM_COMMANDHELP id //#include "CDP5Cfg.h" #include "PowerPageRes.h" #include "PowerPage.h" #include ".\PowerPage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CPowerPage property page IMPLEMENT_DYNCREATE(CPowerPage, CCfgPropPage) //#define IDD_POWER_PAGE 109 //CPowerPage::CPowerPage() : CCfgPropPage(CPowerPage::IDD) CPowerPage::CPowerPage() : CCfgPropPage("IDD_POWER_PAGE") { //{{AFX_DATA_INIT(CPowerPage) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } CPowerPage::~CPowerPage() { } void CPowerPage::DoDataExchange(CDataExchange* pDX) { CCfgPropPage::DoDataExchange(pDX); //{{AFX_DATA_MAP(CPowerPage) //}}AFX_DATA_MAP DDX_Control(pDX, IDC_STATIC_POWER_PAGE, m_PowerPageLabel); DDX_Control(pDX, IDC_STATIC_POWER_ADVANCED, m_PowerAdvancedLabel); DDX_Control(pDX, IDC_STATIC_POWER_STANDARD, m_PowerStandardLabel); DDX_Control(pDX, IDC_STATIC_HV_SIGN1, m_PowerHvSign1); DDX_Control(pDX, IDC_STATIC_HV_SIGN2, m_PowerHvSign2); DDX_Control(pDX, IDC_STATIC_HV_WARNING, m_PowerHvWarning); } BEGIN_MESSAGE_MAP(CPowerPage, CCfgPropPage) //{{AFX_MSG_MAP(CPowerPage) //}}AFX_MSG_MAP ON_CBN_SELCHANGE(IDC_OPT_COMBO_PAPS, OnCbnSelchangeOptComboPaps) ON_CBN_SELCHANGE(IDC_OPT_COMBO_HVSE, OnCbnSelchangeOptComboHvse) ON_CBN_SELCHANGE(IDC_OPT_COMBO_TECS, OnCbnSelchangeOptComboTecs) ON_EN_CHANGE(IDC_OPT_TEXT_HVSE, OnEnChangeOptTextHvse) ON_EN_CHANGE(IDC_OPT_TEXT_TECS, OnEnChangeOptTextTecs) ON_CBN_SELCHANGE(IDC_OPT_COMBO_BOOT, OnCbnSelchangeOptComboBoot) ON_BN_CLICKED(IDC_RADIO_HV_SIGN1, OnBnClickedRadioHvSign1) ON_BN_CLICKED(IDC_RADIO_HV_SIGN2, OnBnClickedRadioHvSign2) ON_COMMAND(ID_HELP, OnHelp) ON_WM_HELPINFO() END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPowerPage message handlers BOOL CPowerPage::OnSetActive() { // TODO: Add your specialized code here and/or call the base class if (s.ReloadCfg) { InitControls(); } else { SetHvPowerWarning(); } return CCfgPropPage::OnSetActive(); } void CPowerPage::Init_PAPS_Controls() { CComboBox* pCombo; if ((s.profile->device_type == dppDP5G) || (s.profile->device_type == dppTB5)) { GetDlgItem(IDC_OPT_FRAME_PAPS)->ShowWindow(SW_HIDE); GetDlgItem(IDC_OPT_COMBO_PAPS)->ShowWindow(SW_HIDE); GetDlgItem(IDC_OPT_UNITS_PAPS)->ShowWindow(SW_HIDE); } else if ((s.profile->device_type == dppDP5) || (s.profile->device_type == dppDP5X)) { pCombo = (CComboBox*)GetDlgItem(IDC_OPT_COMBO_PAPS); pCombo->ResetContent(); pCombo->AddString("8.5"); pCombo->AddString("5"); pCombo->AddString("OFF"); pCombo->AddString("ON"); } else if ((s.profile->device_type == dppPX5) && (s.DP5Stat.m_DP5_Status.DPP_options == PX5_OPTION_HPGe_HVPS)) { pCombo = (CComboBox*)GetDlgItem(IDC_OPT_COMBO_PAPS); pCombo->ResetContent(); pCombo->AddString("OFF"); pCombo->AddString("ON"); } else if (s.profile->device_type == dppPX5) { pCombo = (CComboBox*)GetDlgItem(IDC_OPT_COMBO_PAPS); pCombo->ResetContent(); pCombo->AddString("8.5"); pCombo->AddString("5"); pCombo->AddString("OFF"); } } BOOL CPowerPage::OnInitDialog() { CCfgPropPage::OnInitDialog(); BuildToolTips(); Init_PAPS_Controls(); CComboBox* pComboHV; pComboHV = (CComboBox*)GetDlgItem(IDC_OPT_COMBO_HVSE); pComboHV->SetCurSel(0); GetDlgItem(IDC_OPT_TEXT_HVSE)->SetWindowText("0"); SetHVSign(TRUE); // TRUE == + (pos) m_PowerPageLabel .SetFontName("Arial") .SetFontSize(24) .SetTextColor(RGB(0,0,255)) .SetBkColor(RGB(244, 243, 238)) .SetFontItalic(TRUE) .SetFontBold(TRUE); m_PowerAdvancedLabel .SetFontName("Arial") .SetFontSize(18) .SetTextColor(RGB(0, 70, 213)) .SetBkColor(RGB(246, 245, 241)) .SetFontItalic(TRUE) .SetFontBold(FALSE); m_PowerStandardLabel .SetFontName("Arial") .SetFontSize(18) .SetTextColor(RGB(0, 70, 213)) .SetBkColor(RGB(252, 252, 253)) .SetFontItalic(TRUE) .SetFontBold(FALSE); m_PowerHvSign1 .SetFontName("Arial") .SetFontSize(24) .SetTextColor(RGB(0, 0, 255)) .SetBkColor(RGB(252, 252, 253)) .SetFontItalic(FALSE) .SetFontBold(TRUE); m_PowerHvSign2 .SetFontName("Arial") .SetFontSize(24) .SetTextColor(RGB(255, 0, 0)) .SetBkColor(RGB(252, 252, 253)) .SetFontItalic(FALSE) .SetFontBold(TRUE); m_PowerHvWarning .SetFontName("Arial") .SetFontSize(12) .SetTextColor(RGB(255, 0, 0)) .SetBkColor(RGB(247, 246, 243)) .SetFontItalic(FALSE) .SetFontBold(TRUE); InitControls(); // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } //dciPAPS PAPS IDC_OPT_COMBO_PAPS 0 dctCbo dcgPower PreAmp 8.5/5 (N/A) V //dciHVSE HVSE IDC_OPT_COMBO_HVSE IDC_OPT_TEXT_HVSE dctCboTxt dcgPower HV Set V //dciTECS TECS IDC_OPT_COMBO_TECS IDC_OPT_TEXT_TECS dctCboTxt dcgPower TEC Set K void CPowerPage::InitControls() { HWND hPage = this->GetSafeHwnd(); BOOL bEnableTECS; BOOL bEnableHVSE; BOOL bEnableBOOT; int DppType; DppType = s.profile->device_type; bEnableTECS = (((DppType == dppDP5) && s.DP5Stat.m_DP5_Status.PC5_PRESENT) || (DppType == dppPX5) || (DppType == dppDP5X)); bEnableHVSE = (((DppType != dppPX5) && s.DP5Stat.m_DP5_Status.PC5_PRESENT) || (DppType == dppPX5)); bEnableBOOT = ((DppType == dppDP5) || (DppType == dppDP5X)); GetDlgItem(IDC_OPT_FRAME_TECS)->EnableWindow(bEnableTECS); GetDlgItem(IDC_OPT_COMBO_TECS)->EnableWindow(bEnableTECS); GetDlgItem(IDC_OPT_TEXT_TECS)->EnableWindow(bEnableTECS); GetDlgItem(IDC_OPT_LIMITS_TECS)->EnableWindow(bEnableTECS); GetDlgItem(IDC_OPT_UNITS_TECS)->EnableWindow(bEnableTECS); GetDlgItem(IDC_OPT_FRAME_HVSE)->EnableWindow(bEnableHVSE); GetDlgItem(IDC_OPT_COMBO_HVSE)->EnableWindow(bEnableHVSE); GetDlgItem(IDC_OPT_TEXT_HVSE)->EnableWindow(bEnableHVSE); GetDlgItem(IDC_OPT_LIMITS_HVSE)->EnableWindow(bEnableHVSE); GetDlgItem(IDC_OPT_UNITS_HVSE)->EnableWindow(bEnableHVSE); // Enable/Disable HV Polarity Controls GetDlgItem(IDC_RADIO_HV_SIGN1)->EnableWindow(bEnableHVSE); GetDlgItem(IDC_RADIO_HV_SIGN2)->EnableWindow(bEnableHVSE); GetDlgItem(IDC_STATIC_HV_SIGN1)->EnableWindow(bEnableHVSE); GetDlgItem(IDC_STATIC_HV_SIGN2)->EnableWindow(bEnableHVSE); GetDlgItem(IDC_OPT_FRAME_BOOT)->EnableWindow(bEnableBOOT); GetDlgItem(IDC_OPT_COMBO_BOOT)->EnableWindow(bEnableBOOT); InitDlgItem(hPage,s.m_DP5Cfg[dciPAPS]); InitDlgItem(hPage,s.m_DP5Cfg[dciHVSE]); // HPGe option +/-5000V if ((s.profile->device_type == dppPX5) && (s.DP5Stat.m_DP5_Status.DPP_options == PX5_OPTION_HPGe_HVPS)) { GetDlgItem(IDC_OPT_LIMITS_HVSE)->SetWindowText(_T("0 to 5000V (+HV) or 0 to -5000V (-HV)")); } InitDlgItem(hPage,s.m_DP5Cfg[dciTECS]); InitDlgItem(hPage,s.m_DP5Cfg[dciBOOT]); CboUpdate(dciPAPS); CboUpdate(dciHVSE); CboUpdate(dciTECS); CboUpdate(dciBOOT); //if (s.profile->device_type == dppMCA8000D) { // ShowMCA8000D_Controls(SW_HIDE); //} else { // ShowMCA8000D_Controls(SW_SHOW); //} } void CPowerPage::ShowMCA8000D_Controls(int iShowWin) { GetDlgItem(IDC_OPT_COMBO_BOOT)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_COMBO_HVSE)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_COMBO_PAPS)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_COMBO_TECS)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_BOOT)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_HVSE)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_PAPS)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_TECS)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_LIMITS_HVSE)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_LIMITS_TECS)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_TEXT_HVSE)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_TEXT_TECS)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_HVSE)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_PAPS)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_TECS)->ShowWindow(iShowWin); GetDlgItem(IDC_STATIC_HV_SIGN1)->ShowWindow(iShowWin); GetDlgItem(IDC_STATIC_HV_SIGN2)->ShowWindow(iShowWin); GetDlgItem(IDC_RADIO_HV_SIGN1)->ShowWindow(iShowWin); GetDlgItem(IDC_RADIO_HV_SIGN2)->ShowWindow(iShowWin); } void CPowerPage::InitDlgItem(HWND hDlg, DP5_CONFIGURATION cfg) { int cboDP5CtrlID = cfg.ListCtrlID; int txtDP5CtrlID = cfg.TextCtrlID; CString strVal = cfg.Setting; int idxList; CString strUnits; CString strLimits; if ((cfg.CtrlType & dctCbo) > 0) { // try to find list index for any combo CComboBox &cb = *(CComboBox *) GetDlgItem(cboDP5CtrlID); //idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,strVal); idxList = s.CtrlUtil.FindCboIdxExact(hDlg,cboDP5CtrlID,strVal); // try exact first if (idxList == LB_ERR) { idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,strVal); } if (idxList == LB_ERR) { // if (idxList != LB_ERR) we already found the value if ((cfg.CtrlType & dctTxt) > 0) { // if cbotxt must find mask, else set to 0 cfg.TextValue = cfg.Setting; // overwrite if currently editing idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,"#"); if (idxList == LB_ERR) { // mask begins with + idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,"+"); } if (idxList == LB_ERR) { // mask begins with - idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,"-"); } if (idxList == LB_ERR) { // not found default to 0 idxList = 0; } } else { idxList = 0; // set to first item } } cb.SetCurSel(idxList); } if ((cfg.CtrlType & dctTxt) > 0) { if ((cfg.CtrlType & dctCbo) == 0) { // cbo update above if (cfg.Setting.GetLength() > 0) { cfg.TextValue = cfg.Setting; } } GetDlgItem(txtDP5CtrlID)->SetWindowText(cfg.TextValue); strUnits = cfg.Units; strLimits = cfg.Limits; switch (txtDP5CtrlID) { case IDC_OPT_TEXT_HVSE: UNIT_INIT(HVSE, strUnits); LIMIT_INIT(HVSE, strLimits); break; case IDC_OPT_TEXT_TECS: UNIT_INIT(TECS, strUnits); LIMIT_INIT(TECS, strLimits); break; } } } // pass dci id to update combo control and display edit controls if any void CPowerPage::CboUpdate(int nID_dci) { CString strCboText; int nID; int CmdShow; nID = s.m_DP5Cfg[nID_dci].ListCtrlID; if (nID == NULL) { return; } CComboBox &cb = *(CComboBox *) GetDlgItem(nID); int idx = cb.GetCurSel(); if (idx > LB_ERR) { cb.GetLBText(idx,strCboText); s.m_DP5Cfg[nID_dci].ComboIndex = idx; s.m_DP5Cfg[nID_dci].ComboValue = strCboText; } else { return; } if (s.m_DP5Cfg[nID_dci].CtrlType == dctCboTxt) { if (strCboText.Find('#') >= 0) { CmdShow = SW_SHOW; } else { CmdShow = SW_HIDE; } switch (nID) { case IDC_OPT_COMBO_HVSE: ALL_VIS(HVSE, CmdShow); CBO_TEXT_VIS(HVSE, (CmdShow!=0)); break; case IDC_OPT_COMBO_TECS: ALL_VIS(TECS, CmdShow); CBO_TEXT_VIS(TECS, (CmdShow!=0)); break; } } SetModified(TRUE); } //CBO_TEXT_VIS(RESL, (CmdShow!=0)); //CboTextVis(IDC_OPT_COMBO_RESL,IDC_OPT_TEXT_RESL,(CmdShow!=0)); //void CboTextVis(int nIdCbox, int nIdEdit, BOOL isText); void CPowerPage::CboTextVis(int nIdCbox, int nIdEdit, BOOL isText) { UINT ddSize; RECT lpRect; CEdit* pEdit; CComboBox* pCombo; int btnSize = 20; pEdit = (CEdit*)GetDlgItem(nIdEdit); // cast to edit for rect pEdit->GetRect(&lpRect); // get rect ddSize = lpRect.right - lpRect.left; // save width if (isText) { GetDlgItem(nIdEdit)->ShowWindow(SW_SHOW); pCombo = (CComboBox*)GetDlgItem(nIdCbox); pCombo->GetWindowRect(&lpRect); ScreenToClient(&lpRect); //int ddSize1 = lpRect.right - lpRect.left; // save width //TRACE("Combo Edit %d\r\n",ddSize1); lpRect.right = lpRect.left + btnSize; pCombo->MoveWindow(&lpRect,TRUE); pCombo->SetDroppedWidth(ddSize + btnSize); } else { GetDlgItem(nIdEdit)->ShowWindow(SW_HIDE); // hide edit //TRACE("Edit %d\r\n",ddSize); pCombo = (CComboBox*)GetDlgItem(nIdCbox); // cast to combo pCombo->GetWindowRect(&lpRect); // get win size ScreenToClient(&lpRect); // adjust to screen //int ddSize2 = lpRect.right - lpRect.left; // save width //TRACE("Combo %d\r\n",ddSize2); lpRect.right = lpRect.left + ddSize + btnSize; // get restored combo size pCombo->MoveWindow(&lpRect,TRUE); // restore combo pCombo->SetDroppedWidth(ddSize); // restore combo } } // pass dci id to update combo control and display edit controls if any void CPowerPage::TextUpdate(int nID_dci) { CString strText; int nID; int iHV; nID = s.m_DP5Cfg[nID_dci].TextCtrlID; if (nID == NULL) { return; } GetDlgItem(nID)->GetWindowText(strText); if (nID == IDC_OPT_TEXT_HVSE) { if (isHVSignInString(strText)) { // test/remove the sign in the string if (s.DppConfig.bConfigHVPolarity != isHVSignPositive(strText)) { // test for sign change SetHVSign(isHVSignPositive(strText)); // if so change sign } iHV = abs(atoi(strText)); // save abs value in text strText.Format("%d",iHV); // prep for save GetDlgItem(nID)->SetWindowText(strText); // save abs to control } if (!s.DppConfig.bConfigHVPolarity) { strText = "-" + strText; } // fix sign for data save //AfxMessageBox(strText); } s.m_DP5Cfg[nID_dci].TextValue = strText; SetModified(TRUE); } void CPowerPage::OnCbnSelchangeOptComboPaps() { CboUpdate(dciPAPS); } void CPowerPage::OnCbnSelchangeOptComboBoot() { CboUpdate(dciBOOT); } void CPowerPage::OnCbnSelchangeOptComboHvse() { CboUpdate(dciHVSE); } void CPowerPage::OnCbnSelchangeOptComboTecs() { CboUpdate(dciTECS); } void CPowerPage::OnEnChangeOptTextHvse() { TextUpdate(dciHVSE); } void CPowerPage::OnEnChangeOptTextTecs() { TextUpdate(dciTECS); } BOOL CPowerPage::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class //================================================================== MSG msg = *pMsg; if (msg.message == WM_MOUSEMOVE) { // Relay events to the tooltip control msg.hwnd = (HWND)m_ToolTip.SendMessage(TTM_WINDOWFROMPOINT, 0, (LPARAM)&msg.pt); CPoint pt = pMsg->pt; ::ScreenToClient(msg.hwnd, &pt); msg.lParam = MAKELONG(pt.x, pt.y); m_ToolTip.Activate(TRUE); // make sure tooltip is active m_ToolTip.RelayEvent(&msg); // Let the ToolTip process this message. } else if ( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN ) { CWnd* pCurrent= GetFocus(); int ctrl = pCurrent->GetDlgCtrlID(); //if (ctrl == IDC_OPT_TEXT_MCST) { if (isCEditBox(ctrl)) { ::SendMessage(this->m_hWnd, WM_COMMAND, MAKEWPARAM(ctrl, EN_CHANGE), (LPARAM) m_hWnd); CWnd* pNext= pCurrent->GetNextWindow( GW_HWNDNEXT ); pMsg->wParam = VK_TAB; //if ( pNext != NULL ) { // if (pNext->GetDlgCtrlID() != IDOK ) { // pNext->SetFocus(); // return TRUE; // } //} } else if (isCComboBox(ctrl)) { CWnd* pNext= pCurrent->GetNextWindow( GW_HWNDNEXT ); pMsg->wParam = VK_TAB; } } //================================================================== return CCfgPropPage::PreTranslateMessage(pMsg); } BOOL CPowerPage::isCEditBox(int nID) { BOOL isEdit = FALSE; switch (nID) { case IDC_OPT_TEXT_HVSE: isEdit = TRUE; break; case IDC_OPT_TEXT_TECS: isEdit = TRUE; break; } return isEdit; } BOOL CPowerPage::isCComboBox(int nID) { BOOL isCombo = FALSE; switch (nID) { case IDC_OPT_COMBO_PAPS: isCombo = TRUE; break; case IDC_OPT_COMBO_BOOT: isCombo = TRUE; break; case IDC_OPT_COMBO_HVSE: isCombo = TRUE; break; case IDC_OPT_COMBO_TECS: isCombo = TRUE; break; } return isCombo; } void CPowerPage::SetHVSign(BOOL isPOS) { CButton *chkEnable; chkEnable = (CButton *)GetDlgItem(IDC_RADIO_HV_SIGN1); //+ (pos) chkEnable->SetCheck(isPOS); s.DppConfig.bConfigHVPolarity = isPOS; CButton *chkDisable; chkDisable = (CButton *)GetDlgItem(IDC_RADIO_HV_SIGN2); //- (neg) chkDisable->SetCheck(!isPOS); SetHvPowerWarning(); } BOOL CPowerPage::isHVSignInString(CString strHV) { int iFound; iFound = strHV.FindOneOf("+-"); return (iFound > -1); } BOOL CPowerPage::isHVSignPositive(CString strHV) { int iFound; iFound = strHV.Find('-'); return (iFound == -1); } void CPowerPage::OnBnClickedRadioHvSign1() { SetHVSign(TRUE); // TRUE == + (pos) TextUpdate(dciHVSE); } void CPowerPage::OnBnClickedRadioHvSign2() { SetHVSign(FALSE); // FALSE == - (neg) TextUpdate(dciHVSE); } //s.DppConfig.bGammaRadHVMode; // GammaRad HV //s.DppConfig.bConfigHVPolarity; // Detector HV Polarity, for setup warnings //s.DppConfig.bPC5Detected; // PC5 connected,PX5 HV Pwr Error //s.DppConfig.bBootHVPolarity; // HV Polarity from status packet //s.DppConfig.bAnalogPolarity; // Analog Input Polarity, for setup warnings //m_PowerHvWarning==IDC_STATIC_HV_WARNING void CPowerPage::SetHvPowerWarning() { CString strPolarity; CString strWarning; m_PowerHvWarning.ShowWindow(SW_HIDE); if (s.isDppConnected) { // disable warnings for px5 with HPGe option if ((s.profile->device_type == dppPX5) && (s.DP5Stat.m_DP5_Status.DPP_options == PX5_OPTION_HPGe_HVPS)) { return; } if (s.DppConfig.bPC5Detected) { if (s.DppConfig.bAnalogPolarity == s.DppConfig.bConfigHVPolarity) { m_PowerHvWarning.ShowWindow(SW_SHOW); strWarning = " Input and HV polarity \r incorrect for Amptek detectors"; if (s.DppConfig.bConfigHVPolarity) { strPolarity = " \r BOTH + (POS)"; } else { strPolarity = " \r BOTH - (NEG)"; } m_PowerHvWarning.SetWindowText(strWarning + strPolarity); } else { m_PowerHvWarning.SetWindowText(""); } } else if (s.profile->device_type == dppPX5) { m_PowerHvWarning.ShowWindow(SW_SHOW); m_PowerHvWarning.SetWindowText("PX5 HV Power Error"); } else { // no pc5 or hv detected m_PowerHvWarning.SetWindowText(""); } } else { // not connected m_PowerHvWarning.SetWindowText(""); } } //////////////////////////////////////////////////////////////////////////////////// // HtmlHelp for shared dialog // NOTE: shared dialogs use string type IDD, not global IDD BOOL CPowerPage::OnHelpInfo(HELPINFO* pHelpInfo) { CString strHelp; if (pHelpInfo->iContextType == HELPINFO_WINDOW) { if (pHelpInfo->dwContextId == 0) { ::HtmlHelp(this->GetSafeHwnd(), theApp.m_pszHelpFilePath, HH_HELP_CONTEXT, HIDD_POWER_PAGE); } else { // } } return true; } void CPowerPage::OnHelp() // enable property sheet help button help { ::HtmlHelp(this->GetSafeHwnd(), theApp.m_pszHelpFilePath, HH_HELP_CONTEXT, HIDD_POWER_PAGE); //SendMessage(WM_COMMANDHELP); // } //////////////////////////////////////////////////////////////////////////////////// void CPowerPage::BuildToolTips() { if (!m_ToolTip.Create(this)) { TRACE0("Unable to create ToolTip control\n"); } else { m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_BOOT), IDS_TT_PC__ON_AT_STARTUP); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_COMBO_BOOT), IDS_TT_PC__ON_AT_STARTUP); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_HVSE), IDS_TT_HIGH_VOLTAGE_BIAS); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_HVSE), IDS_TT_HIGH_VOLTAGE_BIAS); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_HVSE), IDS_TT_HIGH_VOLTAGE_BIAS); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_HVSE), IDS_TT_HIGH_VOLTAGE_BIAS); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_COMBO_HVSE), IDS_TT_HIGH_VOLTAGE_BIAS); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_COMBO_PAPS), IDS_TT_PREAMP_VOLTAGE); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_PAPS), IDS_TT_PREAMP_VOLTAGE); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_PAPS), IDS_TT_PREAMP_VOLTAGE); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_TECS), IDS_TT_COOLER_TEMPERATURE); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_TECS), IDS_TT_COOLER_TEMPERATURE); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_TECS), IDS_TT_COOLER_TEMPERATURE); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_TECS), IDS_TT_COOLER_TEMPERATURE); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_COMBO_TECS), IDS_TT_COOLER_TEMPERATURE); m_ToolTip.AddTool(GetDlgItem(IDC_STATIC_HV_SIGN1), IDS_TT_HIGH_VOLTAGE_POLARITY); m_ToolTip.AddTool(GetDlgItem(IDC_RADIO_HV_SIGN1), IDS_TT_HIGH_VOLTAGE_POLARITY); m_ToolTip.AddTool(GetDlgItem(IDC_STATIC_HV_SIGN2), IDS_TT_HIGH_VOLTAGE_POLARITY); m_ToolTip.AddTool(GetDlgItem(IDC_RADIO_HV_SIGN2), IDS_TT_HIGH_VOLTAGE_POLARITY); m_ToolTip.Activate(TRUE); m_ToolTip.SetMaxTipWidth(200); } }