BOOL CDlgAllCheckOut::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) { CWnd * pWnd = GetFocus(); if (pWnd != NULL) { if (pWnd->GetDlgCtrlID() == IDC_EDIT_FIND) { OnBnClickedButtonQuery(); return TRUE; } } } //拦截焦点 if (WM_CHAR == pMsg->message && pMsg->wParam != VK_RETURN) { CWnd* pWnd = GetFocus(); if (pWnd != NULL && pWnd->GetDlgCtrlID() != IDC_EDIT_FIND) { GetDlgItem(IDC_EDIT_FIND)->SetFocus(); GetDlgItem(IDC_EDIT_FIND)->PostMessage(WM_CHAR, pMsg->wParam, pMsg->lParam); return TRUE; } } return CIBADialog::PreTranslateMessage(pMsg); }
//------------------------------------------------------------------------ //! Send LV_DISPINFO structure as LVN_ENDLABELEDIT from CListCtrl to parent window //! //! @param wndListCtrl The list control starting edit //! @param nRow The index of the row //! @param nCol The index of the column //! @param lvDispInfo Specifies the properties of the new cell value //! @return Result of the SendMessage to parent window //------------------------------------------------------------------------ LRESULT CGridColumnTraitImage::SendEndLabelEdit(CWnd& wndListCtrl, int nRow, int nCol, LV_DISPINFO& lvDispInfo) { lvDispInfo.hdr.hwndFrom = wndListCtrl.m_hWnd; lvDispInfo.hdr.idFrom = static_cast<UINT_PTR>(wndListCtrl.GetDlgCtrlID()); lvDispInfo.hdr.code = LVN_ENDLABELEDIT; lvDispInfo.item.iItem = nRow; lvDispInfo.item.iSubItem = nCol; return wndListCtrl.GetParent()->SendMessage(WM_NOTIFY, static_cast<WPARAM>(wndListCtrl.GetDlgCtrlID()), reinterpret_cast<LPARAM>(&lvDispInfo)); }
//------------------------------------------------------------------------ //! Send LV_DISPINFO structure as LVN_ENDLABELEDIT from CListCtrl to parent window //! //! @param wndListCtrl The list control starting edit //! @param nRow The index of the row //! @param nCol The index of the column //! @param lvDispInfo Specifies the properties of the new cell value //! @return Result of the SendMessage to parent window //------------------------------------------------------------------------ LRESULT CGridColumnTraitImage::SendEndLabelEdit(CWnd& wndListCtrl, int nRow, int nCol, LV_DISPINFO& lvDispInfo) { lvDispInfo.hdr.hwndFrom = wndListCtrl.m_hWnd; lvDispInfo.hdr.idFrom = (UINT_PTR)wndListCtrl.GetDlgCtrlID(); lvDispInfo.hdr.code = LVN_ENDLABELEDIT; lvDispInfo.item.iItem = nRow; lvDispInfo.item.iSubItem = nCol; return wndListCtrl.GetParent()->SendMessage( WM_NOTIFY, (WPARAM)wndListCtrl.GetDlgCtrlID(), (LPARAM)&lvDispInfo ); }
void CAboutDlg::OnLButtonDown(UINT nFlags, CPoint point) { CWnd* pWnd = ChildWindowFromPoint(point); if (pWnd == nullptr) return; if (pWnd->GetDlgCtrlID() == IDC_MAILTO) ShellExecute(nullptr, L"open", L"mailto:[email protected]", nullptr, nullptr, NULL); if (pWnd->GetDlgCtrlID() == IDC_HTTPGITHUB) ShellExecute(nullptr, L"open", L"https://github.com/jovibor/Shutdown", nullptr, nullptr, NULL); }
BOOL CChildToolTip::EnableToolTips(CWnd *pWnd, BOOL bEnable, BOOL UseDlgIDs) { if (bEnable) { if (m_ToolTip != NULL) return(TRUE); // already enabled, nothing to do m_ToolTip = new CToolTipCtrl; if (!m_ToolTip->Create(pWnd)) return(FALSE); // iterate over our child controls, adding them to tooltip CWnd *p = pWnd->GetWindow(GW_CHILD); while (p != NULL) { if (UseDlgIDs) { int nID = p->GetDlgCtrlID(); if (nID != -1) { if (!m_ToolTip->AddTool(p, nID)) return(FALSE); } } else { if (!m_ToolTip->AddTool(p)) return(FALSE); } p = p->GetWindow(GW_HWNDNEXT); } } else { if (m_ToolTip == NULL) return(TRUE); // already disabled, nothing to do delete m_ToolTip; m_ToolTip = NULL; } return(TRUE); }
LRESULT CFindEditCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { if (message == WM_SYSCOMMAND && wParam == SC_KEYMENU) { // This should be an entry keyboard shortcut! CWnd *pWnd = GetFocus(); if (pWnd == NULL) return 0L; // But only if we have Focus if (pWnd->GetDlgCtrlID() != ID_TOOLBUTTON_FINDEDITCTRL) goto exit; // Need base character excluding special keys short siKeyStateVirtualKeyCode = VkKeyScan(lParam & 0xff); WORD wVirtualKeyCode = siKeyStateVirtualKeyCode & 0xff; if (wVirtualKeyCode != 0) { WORD wModifiers(0); if (GetKeyState(VK_CONTROL) & 0x8000) wModifiers |= MOD_CONTROL; if (GetKeyState(VK_MENU) & 0x8000) wModifiers |= MOD_ALT; if (GetKeyState(VK_SHIFT) & 0x8000) wModifiers |= MOD_SHIFT; if (!app.GetMainDlg()->ProcessEntryShortcut(wVirtualKeyCode, wModifiers)) return 0; } } exit: return CEditExtn::WindowProc(message, wParam, lParam); }
bool CToolBarXP::InsertControl (int nIndex, CWnd& Ctrl) { TBBUTTON tbbutton; int nCount = DefWindowProc (TB_BUTTONCOUNT, 0, 0); CWindowRect rcCtrl (Ctrl); tbbutton.iBitmap = rcCtrl.Width(); tbbutton.idCommand = Ctrl.GetDlgCtrlID(); tbbutton.fsState = 0; tbbutton.fsStyle = TBSTYLE_SEP; tbbutton.bReserved[0] = 0; tbbutton.bReserved[1] = 0; tbbutton.iString = -1; tbbutton.dwData = NULL; if ( nIndex < 0 || nIndex > nCount ) { nIndex = nCount; } if ( GetToolBarCtrl().InsertButton (nIndex, &tbbutton) ) { m_bDelayedButtonLayout = true; return true; } return false; }
void CPatchPageDlg::OnPaint() { if (theApp.GetMain()->IsMidiLearn()) { // if learning MIDI assignments CPaintDC dc(this); // device context for painting CWnd *pFocusWnd = GetFocus(); // if focus window is one of our controls if (pFocusWnd != NULL && IsChild(pFocusWnd)) { int iPart; // find MIDI target corresponding to control, if any int iTarget = theApp.GetMain()->GetCtrlMidiTarget(pFocusWnd, iPart); if (iTarget < 0) { // if target not found int nID = pFocusWnd->GetDlgCtrlID(); if (nID == IDC_PART_IN_PORT || nID == IDC_PART_IN_CHAN) iTarget = INT_MAX; // input port/channel are special targets } if (iTarget >= 0) { // if control mapped to MIDI target COLORREF cSel = RGB(0, 255, 0); CRect rSel; GetSelectionRect(pFocusWnd, rSel); dc.FillSolidRect(rSel, cSel); // highlight control } } } else { // not learning MIDI assignments Default(); } }
BOOL ArxDbgUiTdcObjReactorsBase::PreTranslateMessage(MSG* pMsg) { if ((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN)) { CWnd *pWnd = GetFocus(); if (pWnd != NULL) { UINT nID = pWnd->GetDlgCtrlID(); if (nID == ARXDBG_BN_ATTACH_ENT) { ::PostMessage(m_attachEntButton.m_hWnd, BM_CLICK, 0, 0); return TRUE; } if (nID == ARXDBG_BN_DETACH_ENT) { ::PostMessage(m_detachEntButton.m_hWnd, BM_CLICK, 0, 0); return TRUE; } if (nID == ARXDBG_BN_DETACH_SEL_ENTS) { ::PostMessage(m_detachSelectedEntsButton.m_hWnd, BM_CLICK, 0, 0); return TRUE; } if (nID == ARXDBG_BN_DETACH_SEL_OBJS) { ::PostMessage(m_detachSelectedObjsButton.m_hWnd, BM_CLICK, 0, 0); return TRUE; } } } return CAcUiTabChildDialog::PreTranslateMessage(pMsg); }
BOOL CGeneralMsgBox::PreTranslateMessage(MSG *pMsg) { if (pMsg->message == WM_KEYDOWN) { if (pMsg->wParam == VK_RETURN) { CWnd *pWnd = GetFocus(); if (pWnd != NULL) { UINT uiIDC = (UINT)pWnd->GetDlgCtrlID(); for (int i = 0; i < m_aBtns.GetSize(); ++i) if (m_aBtns[i].uiIDC == uiIDC) { m_uiDefCmdId = uiIDC; break; } } EndDialog(m_uiDefCmdId); return TRUE; } else if (pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_CANCEL) { if (m_uiEscCmdId != (UINT)IDC_STATIC) EndDialog(m_uiEscCmdId); return TRUE; } } return CDialog::PreTranslateMessage(pMsg); }
int CPopupHelpStyle::WndProcBeforeOldProc(UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_HELP) { helper::ShowContextHelp((HELPINFO *)lParam); return DONT_CALL_OLD_PROC; } // 用户按下鼠标右键就会弹出帮助框, // 调试模式会引发一个assertion: wincore.cpp 875 //else if (msg == WM_RBUTTONUP) else if (0) { CPoint pt(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); HELPINFO hi = {sizeof(HELPINFO)}; hi.dwContextId = HELPINFO_WINDOW; hi.MousePos = pt; m_pWnd->ScreenToClient(&pt); CWnd *pWnd = m_pWnd->ChildWindowFromPoint(pt); if (pWnd != NULL) { hi.hItemHandle = pWnd->m_hWnd; hi.iCtrlId = pWnd->GetDlgCtrlID(); helper::ShowContextHelp(&hi); return DONT_CALL_OLD_PROC; } } return RETURN_DEFAULT; }
BOOL CLoungeDlg::PreTranslateMessage(MSG* pMsg) { BOOL rc = FALSE; // If focus is in some other than a button, eat ENTER and ESC // so the app won't exit accidentally if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE) { // Eat ESC always if (pMsg->wParam == VK_ESCAPE) return TRUE; CWnd* pWnd = GetFocus(); if (pWnd) { int ctrlID = pWnd->GetDlgCtrlID(); if (!isButton(ctrlID)) return TRUE; // Ignore } } rc = CDialog::PreTranslateMessage(pMsg); return rc; }
HBRUSH CMainTestView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: 在此更改 DC 的任何属性 // TODO: 如果默认的不是所需画笔,则返回另一个画笔 CRect rect; //CWnd* hWndChild = ::GetWindow(m_hWnd, GW_CHILD); CWnd* hWndChild = GetWindow(GW_CHILD); while(hWndChild) { if(hWndChild->GetDlgCtrlID()==331 && nCtlColor== CTLCOLOR_STATIC) { COLORREF backColor = RGB(236, 233, 216);//这个颜色为Formview默认的面板颜色 hWndChild->GetClientRect(&rect); pDC->FillSolidRect(&rect,backColor); pDC->SetBkColor(backColor); return CreateSolidBrush(backColor);//创建背景刷子 } hWndChild = hWndChild-> GetNextWindow(); } return hbr; }
BOOL CJXCRetailOnlineDlg::PreTranslateMessage(MSG* pMsg) { //设定时间内不允许处理消息 if (!m_bAllowPretranslate) { return CBCGPDialog::PreTranslateMessage(pMsg); } if (WM_KEYDOWN == pMsg->message && VK_RETURN == pMsg->wParam) //按回车 { CWnd* pWnd = GetFocus(); //焦点何处 if (pWnd != NULL) { if (pWnd->GetDlgCtrlID() == IDC_EDIT_COMMODITYID) { if (QueryCommodity())//商品查询 { m_bAllowPretranslate = FALSE; SetTimer(1001, 1000, NULL); return TRUE; } } } } if (WM_KEYDOWN == pMsg->message && VK_ESCAPE == pMsg->wParam ) { GetParent()->GetParent()->PostMessage(WM_CLOSE); } return CNDDialog::PreTranslateMessage(pMsg); }
void CPageDataReport::OnSize(UINT nType, int cx, int cy) { CDialogEx::OnSize(nType, cx, cy); // TODO: 在此处添加消息处理程序代码 if (nType == SIZE_MINIMIZED) { return; } CWnd *pWnd = NULL; pWnd = GetWindow(GW_CHILD); while (pWnd) { DWORD dwFlag = SIZE_NO_CHANGE; if (pWnd->GetDlgCtrlID() == IDC_LIST_QUERY) { dwFlag = SIZE_ELASTIC_X_EX | SIZE_ELASTIC_Y_EX; } else { dwFlag = SIZE_MOVE_X | SIZE_ELASTIC_X; } ChangeSize(pWnd,cx,cy,dwFlag); pWnd = pWnd->GetWindow(GW_HWNDNEXT); } GetClientRect(&m_rect); }
void CISRSummary::OnLButtonDown(UINT nFlags, CPoint point) { if (m_pPropertySheet) m_pPropertySheet->SetToClose(0); CWnd* pWnd; if ((pWnd = ChildWindowFromPoint(point,CWP_ALL))!=NULL) { UINT index = pWnd->GetDlgCtrlID(); if ((index >= IDC_ISRSUMMARY_FIRST) && (index <= IDC_ISRSUMMARY_LAST)) { if ((index == IDC_ISRSUMMARY_COMMAND6) || (index == IDC_ISRSUMMARY_COMMAND5) || (index == IDC_ISRSUMMARY_COMMAND4) || (index == IDC_ISRSUMMARY_COMMAND3) || (index == IDC_ISRSUMMARY_COMMAND2) || (index == IDC_ISRSUMMARY_COMMAND1)) { char Text[256]; Text[0] = NULL; GetDlgItemText(index,Text,sizeof(Text)); if (strlen(Text)) { strcat(Text,"\""); memmove(&Text[2],Text,strlen(Text)+1); Text[0] = '"'; Text[1] = 'I'; _spawnl(_P_NOWAIT,m_pParent->m_szUtilFile,"MsgUtil.exe",Text,NULL); } } } } CPropertyPage::OnLButtonDown(nFlags, point); }
CWnd* AFXAPI _AfxFindDlgItem(CWnd* pWndParent, DWORD id) { CWnd* pWndChild; CWnd* pWndOrig; // QUICK TRY: pWndChild = pWndParent->GetDlgItem(id); if (pWndChild != NULL) return pWndChild; pWndOrig = _AfxNextControl(pWndParent, NULL, CWP_SKIPINVISIBLE); if (pWndOrig == pWndParent) return NULL; pWndChild = pWndOrig; do { if ((DWORD)pWndChild->GetDlgCtrlID() == id) return(pWndChild); pWndChild = _AfxNextControl(pWndParent, pWndChild, CWP_SKIPINVISIBLE); } while ((pWndChild != NULL) && (pWndChild != pWndOrig)); return NULL; }
void CPopupEdit::OnKillFocus(CWnd* pNewWnd) { CEdit::OnKillFocus(pNewWnd); CString Text; GetWindowText(Text); if (Text != "INFINITY") { if (!atoi(Text)) { SetWindowText(m_sInitText); GetWindowText(Text); } Text.Format("%d", atoi(Text)); CString Temp; GetWindowText(Temp); Temp = Temp.Right(1); if (!Temp.SpanIncluding("kKmMgG").IsEmpty()) Text.Format("%s%s", LPCTSTR(Text), LPCTSTR(Temp)); CString OldText; GetWindowText(OldText) ; if (GetModify() || OldText != Text) SetWindowText(Text); } if (m_bIsEmbeddedIntoListCtrl) { CWnd *Parent = GetParent(); ASSERT_VALID(Parent); CString str; GetWindowText(str); LV_DISPINFO dispinfo; dispinfo.hdr.hwndFrom = Parent->m_hWnd; dispinfo.hdr.idFrom = GetDlgCtrlID(); dispinfo.hdr.code = LVN_ENDLABELEDIT; dispinfo.item.mask = LVIF_TEXT; dispinfo.item.iItem = m_iItem; dispinfo.item.iSubItem = m_iSubItem; if (m_bESC) { dispinfo.item.pszText = NULL; dispinfo.item.cchTextMax = 0; } else { dispinfo.item.pszText = const_cast<LPTSTR>((LPCTSTR) str); dispinfo.item.cchTextMax = str.GetLength(); } CWnd *ParentParent = Parent->GetParent(); ASSERT_VALID(ParentParent); ParentParent->SendMessage(WM_NOTIFY, Parent->GetDlgCtrlID(), LPARAM(&dispinfo)); DestroyWindow(); } }
BOOL CCardopenConsumeView::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) { CWnd * pWnd = GetFocus(); if (pWnd) { if (pWnd->GetDlgCtrlID() == IDC_BUTTON_STARTTIME ||pWnd->GetDlgCtrlID() == IDC_BUTTON_ENDTIME ||pWnd->GetDlgCtrlID() == IDC_BUTTON_QUERY) { PostMessage(WM_COMMAND, MAKEWPARAM(IDC_BUTTON_QUERY, BN_CLICKED),(LPARAM)GetDlgItem(IDC_BUTTON_QUERY)->m_hWnd); } } } return CIBAFormView::PreTranslateMessage(pMsg); }
BOOL CConfigGeneral::OnInitDialog() { char Text[64]; CPropertyPage::OnInitDialog(); m_bWrapCursor = theApp.GetSettings()->General.bWrapCursor; m_bWrapFrames = theApp.GetSettings()->General.bWrapFrames; m_bFreeCursorEdit = theApp.GetSettings()->General.bFreeCursorEdit; m_bPreviewWAV = theApp.GetSettings()->General.bWavePreview; m_bKeyRepeat = theApp.GetSettings()->General.bKeyRepeat; m_bRowInHex = theApp.GetSettings()->General.bRowInHex; m_iEditStyle = theApp.GetSettings()->General.iEditStyle; m_bFramePreview = theApp.GetSettings()->General.bFramePreview; m_bNoDPCMReset = theApp.GetSettings()->General.bNoDPCMReset; m_bNoStepMove = theApp.GetSettings()->General.bNoStepMove; m_iPageStepSize = theApp.GetSettings()->General.iPageStepSize; m_bPullUpDelete = theApp.GetSettings()->General.bPullUpDelete; m_bBackups = theApp.GetSettings()->General.bBackups; m_bSingleInstance = theApp.GetSettings()->General.bSingleInstance; m_iKeyNoteCut = theApp.GetSettings()->Keys.iKeyNoteCut; m_iKeyNoteRelease = theApp.GetSettings()->Keys.iKeyNoteRelease; m_iKeyClear = theApp.GetSettings()->Keys.iKeyClear; m_iKeyRepeat = theApp.GetSettings()->Keys.iKeyRepeat; GetKeyNameText(MapVirtualKey(m_iKeyNoteCut, MAPVK_VK_TO_VSC) << 16, Text, 64); SetDlgItemText(IDC_KEY_NOTE_CUT, Text); GetKeyNameText(MapVirtualKey(m_iKeyNoteRelease, MAPVK_VK_TO_VSC) << 16, Text, 64); SetDlgItemText(IDC_KEY_NOTE_RELEASE, Text); GetKeyNameText(MapVirtualKey(m_iKeyClear, MAPVK_VK_TO_VSC) << 16, Text, 64); SetDlgItemText(IDC_KEY_CLEAR, Text); GetKeyNameText(MapVirtualKey(m_iKeyRepeat, MAPVK_VK_TO_VSC) << 16, Text, 64); SetDlgItemText(IDC_KEY_REPEAT, Text); EnableToolTips(TRUE); m_wndToolTip.Create(this, TTS_ALWAYSTIP); m_wndToolTip.Activate(TRUE); CWnd *pWndChild = GetWindow(GW_CHILD); CString strToolTip; while (pWndChild) { int nID = pWndChild->GetDlgCtrlID(); if (strToolTip.LoadString(nID)) { m_wndToolTip.AddTool(pWndChild, strToolTip); } pWndChild = pWndChild->GetWindow(GW_HWNDNEXT); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point) { CWnd* pWnd = ChildWindowFromPoint(point); if (pWnd == nullptr) //mouse pointer is out of window return; if (m_fMailtoUnderline == (pWnd->GetDlgCtrlID() == IDC_MAILTO)) //is mouse pointer hovering IDC_MAILTO? { m_fMailtoUnderline = !m_fMailtoUnderline; ::InvalidateRect(GetDlgItem(IDC_MAILTO)->m_hWnd, nullptr, FALSE); SetCursor(m_fMailtoUnderline ? m_curArrow : m_curHand); } if (m_fGithubUnderline == (pWnd->GetDlgCtrlID() == IDC_HTTPGITHUB)) { m_fGithubUnderline = !m_fGithubUnderline; ::InvalidateRect(GetDlgItem(IDC_HTTPGITHUB)->m_hWnd, nullptr, FALSE); SetCursor(m_fGithubUnderline ? m_curArrow : m_curHand); } }
//设置统计的字体 void CDlgIBADuty::SetStaticFont() { CWnd* pChildWnd = GetWindow(GW_CHILD); while (pChildWnd != NULL) { TCHAR szClassName[MAX_PATH] = {0}; GetClassName(pChildWnd->GetSafeHwnd(), szClassName, MAX_PATH); if (lstrcmp(szClassName, _T("Static")) == 0) { switch(pChildWnd->GetDlgCtrlID()) { case IDC_STATIC_CREDIT: case IDC_STATIC_RETURNED: case IDC_STATIC_CASHPAY: case IDC_STATIC_DIANKA: case IDC_STATIC_STOREIN: case IDC_STATIC_DEPOSIT: case IDC_STATIC_NETCASH: case IDC_STATIC_RESERVE: case IDC_STATIC_SELFDUTY: case IDC_STATIC_CREDITCARD: case IDC_STATIC_NETBARPAY: case IDC_STATIC_ZSB_CONSUME: case IDC_STATIC_ZSB_BALANCE: GetDlgItem(pChildWnd->GetDlgCtrlID())->SetFont(&m_Font); break; } if (pChildWnd->GetDlgCtrlID() != IDC_STATIC && pChildWnd->GetDlgCtrlID() != IDC_STATIC2_HANDLEIN && pChildWnd->GetDlgCtrlID() != IDC_STATIC2_NEXTRESERVE) { //GetDlgItem(pChildWnd->GetDlgCtrlID())->SetFont(&m_Font); } } pChildWnd = pChildWnd->GetWindow(GW_HWNDNEXT); } }
void CPPageBase::CreateToolTip() { m_wndToolTip.Create(this, TTS_NOPREFIX); m_wndToolTip.Activate(TRUE); m_wndToolTip.SetMaxTipWidth(300); m_wndToolTip.SetDelayTime(TTDT_AUTOPOP, 10000); for (CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetWindow(GW_HWNDNEXT)) { CString strToolTip; if (strToolTip.LoadString(pChild->GetDlgCtrlID())) { m_wndToolTip.AddTool(pChild, strToolTip); } } }
/** @brief user pressed <enter> key. */ void CTestFilterDlg::OnOK() { CWnd *pWnd = GetFocus(); ASSERT (pWnd); if (IDCANCEL == pWnd->GetDlgCtrlID()) { CDialog::OnCancel(); } else { OnTestBtn(); } }
/* #FN# Receives the edit controls content again. The user could press 'Enter' or 'Alt-O' and then all changes he's made in the last edited control would be lost. */ void /* #AS# Nothing */ CNewDiskImageDlg:: ReceiveFocused() { CWnd *pWnd = GetFocus(); UINT nCtrlID = pWnd ? pWnd->GetDlgCtrlID() : 0; if( IDC_NEWDISKIMAGE_SECTORS == nCtrlID ) { OnKillfocusSectors(); } } /* #OF# CNewDiskImageDlg::ReceiveFocused */
/* #FN# Receives the edit controls content again. The user could press 'Enter' or 'Alt-O' and then all changes he's made in the last edited control would be lost. */ void /* #AS# Nothing */ CKeyboardDlg:: ReceiveFocused() { CWnd *pWnd = GetFocus(); UINT nCtrlID = pWnd ? pWnd->GetDlgCtrlID() : 0; if( IDC_KEYBOARD_TEMPLATEFILE == nCtrlID ) { OnKillfocusTemplateFile(); } } /* #OF# CKeyboardDlg::ReceiveFocused */
BOOL CMsgBoxDlg::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_LEFT || pMsg->wParam == VK_RIGHT)) { CWnd* pWnd = GetFocus(); //焦点何处 if (pWnd != NULL) { if (pWnd->GetDlgCtrlID() == IDOK) { GetDlgItem(IDCANCEL)->SetFocus(); return TRUE; } else if (pWnd->GetDlgCtrlID() == IDCANCEL) { GetDlgItem(IDOK)->SetFocus(); return TRUE; } else if (pWnd->GetDlgCtrlID() == IDYES) { GetDlgItem(IDNO)->SetFocus(); return TRUE; } else if (pWnd->GetDlgCtrlID() == IDNO) { GetDlgItem(IDYES)->SetFocus(); return TRUE; } } } return CBCGPDialog::PreTranslateMessage(pMsg); }
void CMFECToolTip::ShowToolTip( CPoint& point ) { #if 1 CWnd* pWnd = m_pParentWnd->ChildWindowFromPoint(point); if( pWnd ) { UINT nControlID = (UINT)pWnd->GetDlgCtrlID(); if( m_currentControlID != nControlID && pWnd->IsWindowVisible()) { ErasePreviousToolTipDisplay(m_currentControlID); ShowToolTip( nControlID ); } } #endif }
BOOL CALLBACK EnumProc(HWND hwnd, LPARAM lParam) { CWnd* pWnd = CWnd::FromHandle(hwnd); CSize* pTranslate = (CSize*) lParam; CAddNewItem* pDlg = (CAddNewItem*) pWnd->GetParent(); if (!pDlg) return FALSE; CRect rect; pWnd->GetWindowRect(rect); pDlg->ScreenToClient(rect); if (hwnd == pDlg->m_GridCtrl.GetSafeHwnd()) { pWnd->MoveWindow(rect.left, rect.top, rect.Width()+pTranslate->cx, rect.Height()+pTranslate->cy, FALSE); }else if(pWnd->GetDlgCtrlID()==IDC_ADDORDER_PROG_BAR){ pWnd->MoveWindow(rect.left+pTranslate->cx/2, rect.top+pTranslate->cy/2, rect.Width(), rect.Height(), FALSE); }else if(pWnd->GetDlgCtrlID()==IDC_DIAG_PRINT) pWnd->MoveWindow(rect.left+pTranslate->cx, rect.top+pTranslate->cy, rect.Width(), rect.Height(), FALSE); else pDlg->UpdateControlPostion(pWnd,rect,lParam); pDlg->Invalidate(); return TRUE; }
void CDemoDescriptionDialog::OnLButtonDblClk(UINT nFlags, CPoint point) { CWnd* pWnd = ChildWindowFromPoint(point); if (pWnd != NULL) { if (pWnd->GetDlgCtrlID() == IDC_DISCOUNT_CD_CATALOG) { // Start up the discount CD catalog! ((CMainFrame*)(AfxGetMainWnd()))->DoProductCatalog(); return; } } CPmwDialog::OnLButtonDblClk(nFlags, point); }