void CGuiEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { // TODO: Add your message handler code here and/or call default if (!m_szMask.IsEmpty()) { if (nChar == VK_DELETE) { m_KeySpecial=1; AfxCallWndProc(this, m_hWnd, WM_CHAR, ' ', 1); return; } if (nChar == VK_BACK) { m_KeySpecial=2; return; } if(nChar == VK_RIGHT) { int nStartPos, nEndPos; GetSel( nStartPos, nEndPos ); m_KeySpecial=3; if (!ValSpecialKey(nStartPos,nEndPos)) SetSel(nStartPos,nStartPos); else { int nNext = GetNextPos(nStartPos); SetSel(nNext,nNext); } return; } } CEdit::OnKeyDown(nChar, nRepCnt, nFlags); }
LRESULT CMDIFrameWnd::OnCommandHelp(WPARAM wParam, LPARAM lParam) { if (lParam == 0 && IsTracking()) lParam = HID_BASE_COMMAND+m_nIDTracking; CMDIChildWnd* pActiveChild = MDIGetActive(); if (pActiveChild != NULL && AfxCallWndProc(pActiveChild, pActiveChild->m_hWnd, WM_COMMANDHELP, wParam, lParam) != 0) { // handled by child return TRUE; } if (CFrameWnd::OnCommandHelp(wParam, lParam)) { // handled by our base return TRUE; } if (lParam != 0) { CWinApp* pApp = AfxGetApp(); if (pApp != NULL) { AfxGetApp()->WinHelpInternal(lParam); return TRUE; } } return FALSE; }
void CMyDateEdit::SendChar(UINT nChar) { m_bMaskKeyInProgress=TRUE; #ifdef WIN32 AfxCallWndProc(this,m_hWnd,WM_CHAR,nChar,1); #else SendMessage(WM_CHAR,nChar,1); #endif m_bMaskKeyInProgress=FALSE; }
LRESULT CMyCon::staticWndProc(HWND hWnd, UINT nMessage, WPARAM wParam, LPARAM lParam) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); CWnd* pControl = CWnd::FromHandlePermanent(hWnd); if (pControl == NULL) { pControl = new CMyCon(); pControl->Attach(hWnd); } return AfxCallWndProc(pControl,hWnd,nMessage,wParam,lParam); }
LRESULT CALLBACK AFX_EXPORT CRygCtrl::RygWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); CWnd* wnd = CWnd::FromHandlePermanent(hwnd); if (wnd == NULL) { // Assume that client created a CRygCtrl window wnd = new CRygCtrl; wnd->Attach(hwnd); } ASSERT(wnd->m_hWnd == hwnd); ASSERT(wnd == CWnd::FromHandlePermanent(hwnd)); LRESULT res = AfxCallWndProc(wnd, hwnd, msg, wparam, lparam); return res; }
// // Window procedure for the "CTextDisplay" window class. This global function // handles the creation of new CTextDisplay objects and subclasses the // objects so the MFC framework passes messages along to the CTextDisplay // member functions. // LRESULT CALLBACK EXPORT CTextDisplay::TextDisplayWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); CWnd *pWnd; // See if we're creating the window. if (!(pWnd = CWnd::FromHandlePermanent(hWnd)) && message == WM_NCCREATE) { // Yes, create the object. pWnd = new CTextDisplay(); pWnd->Attach(hWnd); } return AfxCallWndProc(pWnd, hWnd, message, wParam, lParam); }
bool CWinThread::OnIdle(LONG lCount) { if (lCount <= 0) { if (m_pMainWnd && m_pMainWnd->m_hWnd && m_pMainWnd->IsVisible()) { MSG msg = {m_pMainWnd->m_hWnd, WM_IDLEUPDATECMDUI, TRUE, 0}; AfxCallWndProc(m_pMainWnd, msg); #if !UCFG_WCE m_pMainWnd->SendMessageToDescendants(WM_IDLEUPDATECMDUI, TRUE, 0, TRUE, TRUE); #endif } } return lCount < 0; }
void COleCntrFrameWnd::OnIdleUpdateCmdUI() { // do frame delayed recalc if (m_nIdleFlags & idleLayout) RecalcLayout(m_nIdleFlags & idleNotify); // update control bars POSITION pos = m_listControlBars.GetHeadPosition(); while (pos != NULL) { CControlBar* pBar = (CControlBar*)m_listControlBars.GetNext(pos); ASSERT(pBar != NULL); ASSERT_VALID(pBar); AfxCallWndProc(pBar, pBar->m_hWnd, WM_IDLEUPDATECMDUI, TRUE, 0); } }
BOOL CMainFrame::BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam, HWND tWnd) { BOOL topLevel; topLevel = FALSE; if (tWnd == NULL) { tWnd = m_hWnd; topLevel = TRUE; } // walk through HWNDs to avoid creating temporary CWnd objects // unless we need to call this function recursively for (HWND hWndChild = ::GetTopWindow(tWnd); hWndChild != NULL; hWndChild = ::GetNextWindow(hWndChild, GW_HWNDNEXT)) { CWnd* pWnd = CWnd::FromHandlePermanent(hWndChild); if (pWnd != NULL) { // call window proc directly since it is a C++ window if (AfxCallWndProc(pWnd, pWnd->m_hWnd, msg, wParam, lParam)) { return TRUE; } } else { // send message with Windows SendMessage API if (::SendMessage(hWndChild, msg, wParam, lParam)) return TRUE; } if (::GetTopWindow(hWndChild) != NULL) { // send to child windows after parent if (BroadcastMessage(msg, wParam, lParam, hWndChild)) return TRUE; } } if (topLevel) return SendMessage(msg, wParam, lParam); else return FALSE; }
BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { ASSERT(AfxGetScreenSaverDialog()); if (!AfxGetScreenSaverDialog()) return 0L; if (!AfxGetScreenSaverDialog()->m_hWnd) AfxGetScreenSaverDialog()->Attach(hDlg); LRESULT lResult; if (uMsg == WM_INITDIALOG) { // special case for WM_INITDIALOG CDialog* pDlg = DYNAMIC_DOWNCAST(CDialog, CWnd::FromHandlePermanent(hDlg)); if (pDlg != NULL) lResult = pDlg->OnInitDialog(); else lResult = 1; } else { lResult = AfxCallWndProc( AfxGetScreenSaverDialog(), AfxGetScreenSaverDialog()->m_hWnd, uMsg, wParam, lParam); } if (uMsg == WM_NCDESTROY) { ASSERT(!AfxGetScreenSaverDialog() || !AfxGetScreenSaverDialog()->m_hWnd); } return lResult; }
BOOL CMDIFrameWnd::OnCommand(WPARAM wParam, LPARAM lParam) { // send to MDI child first - will be re-sent through OnCmdMsg later CMDIChildWnd* pActiveChild = MDIGetActive(); if (pActiveChild != NULL && AfxCallWndProc(pActiveChild, pActiveChild->m_hWnd, WM_COMMAND, wParam, lParam) != 0) return TRUE; // handled by child if (CFrameWnd::OnCommand(wParam, lParam)) return TRUE; // handled through normal mechanism (MDI child or frame) HWND hWndCtrl = (HWND)lParam; ASSERT(AFX_IDM_FIRST_MDICHILD == 0xFF00); if (hWndCtrl == NULL && (LOWORD(wParam) & 0xf000) == 0xf000) { // menu or accelerator within range of MDI children // default frame proc will handle it DefWindowProc(WM_COMMAND, wParam, lParam); return TRUE; } return FALSE; // not handled }
LRESULT AFXAPI OurCallWndProc(CWnd* pWnd, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) { LRESULT lResult = AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam); lResult = _PostSubclassHeaderWndProc(pWnd, hWnd, nMsg, wParam, lParam, lResult); return lResult; }
LRESULT AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, CWnd* pWnd) { return AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam); }
LRESULT AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, CWnd *pWnd) // last param. pWnd is added by JJHou. { cout << "AfxWndProc()" << endl; return AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam); }
/*************************************************** MaskKeyStrokes Checks the given key against its input position and the corresponding input mask character. If the input is allowed then TRUE is returned, otherwise FALSE Params: vKey - key value Return TRUE - if the key matches the mask FALSE - if the key does not match the mask ****************************************************/ int CUGMaskedEdit::MaskKeyStrokes(UINT *vKey){ int key = *vKey; if(!m_useMask) return TRUE; // if(isprint(key)==0) return TRUE; //clear all selections, if any Clear(); //check the key against the mask int startPos,endPos; GetSel(startPos,endPos); //make sure the string is not longer than the mask if(endPos >= m_mask.GetLength()) return FALSE; //check to see if a literal is in this position int l = m_literals.GetAt(endPos); if(l != 8){ m_MaskKeyInProgress = TRUE; #ifdef WIN32 AfxCallWndProc(this,m_hWnd,WM_CHAR,l,1); #else SendMessage(WM_CHAR,l,1); #endif m_MaskKeyInProgress = FALSE; GetSel(startPos,endPos); } //check the key against the mask int c = m_mask.GetAt(endPos); switch(c){ case '0':{ if(isdigit(key)) return TRUE; return FALSE; } case '9':{ if(isdigit(key)) return TRUE; if(key == VK_SPACE) return TRUE; return FALSE; } case '#':{ if(isdigit(key)) return TRUE; if(key == VK_SPACE || key == 43 || key == 45) return TRUE; return FALSE; } case 'L':{ if(isalpha(key)) return TRUE; return FALSE; } case '?':{ if(isalpha(key)) return TRUE; if(key == VK_SPACE) return TRUE; return FALSE; } case 'A':{ if(isalnum(key)) return TRUE; return FALSE; } case 'a':{ if(isalnum(key)) return TRUE; if(key == VK_SPACE) return TRUE; return FALSE; } case '&':{ if(isprint(key)) return TRUE; return FALSE; } case 'C':{ if(isprint(key)) return TRUE; return FALSE; } } return TRUE; }