BOOL CChildView::PreTranslateMessage(MSG* pMsg) { if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MYMOUSELAST) { CWnd* pParent = GetParent(); CPoint p(pMsg->lParam); ::MapWindowPoints(pMsg->hwnd, pParent->m_hWnd, &p, 1); bool fDblClick = false; bool fInteractiveVideo = ((CMainFrame*)AfxGetMainWnd())->IsInteractiveVideo(); /* if(fInteractiveVideo) { if(pMsg->message == WM_LBUTTONDOWN) { if((pMsg->time - m_lastlmdowntime) <= GetDoubleClickTime() && abs(pMsg->pt.x - m_lastlmdownpoint.x) <= GetSystemMetrics(SM_CXDOUBLECLK) && abs(pMsg->pt.y - m_lastlmdownpoint.y) <= GetSystemMetrics(SM_CYDOUBLECLK)) { fDblClick = true; m_lastlmdowntime = 0; m_lastlmdownpoint.SetPoint(0, 0); } else { m_lastlmdowntime = pMsg->time; m_lastlmdownpoint = pMsg->pt; } } else if(pMsg->message == WM_LBUTTONDBLCLK) { m_lastlmdowntime = pMsg->time; m_lastlmdownpoint = pMsg->pt; } } */ if((pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONUP || pMsg->message == WM_MOUSEMOVE) && fInteractiveVideo) { if(pMsg->message == WM_MOUSEMOVE) { pParent->PostMessage(pMsg->message, pMsg->wParam, MAKELPARAM(p.x, p.y)); } if(fDblClick) { pParent->PostMessage(WM_LBUTTONDOWN, pMsg->wParam, MAKELPARAM(p.x, p.y)); pParent->PostMessage(WM_LBUTTONDBLCLK, pMsg->wParam, MAKELPARAM(p.x, p.y)); } } else { pParent->PostMessage(pMsg->message, pMsg->wParam, MAKELPARAM(p.x, p.y)); return TRUE; } } return CWnd::PreTranslateMessage(pMsg); }
void CTitleTip::OnMouseMove(UINT nFlags, CPoint point) { if (!m_rectHover.PtInRect(point)) { Hide(); // Forward the message ClientToScreen( &point ); CWnd *pWnd = WindowFromPoint( point ); if ( pWnd == this ) pWnd = m_pParentWnd; int hittest = (int)pWnd->SendMessage(WM_NCHITTEST, 0, MAKELONG(point.x, point.y)); if (hittest == HTCLIENT) { pWnd->ScreenToClient( &point ); pWnd->PostMessage( WM_MOUSEMOVE, nFlags, MAKELONG(point.x, point.y) ); } else { pWnd->PostMessage( WM_NCMOUSEMOVE, hittest, MAKELONG(point.x, point.y) ); } } }
BOOL CDiskWizPassphrasePage::PreTranslateMessage(MSG* pMsg) { switch (pMsg->message) { case WM_KEYDOWN: if ((pMsg->wParam & 0x7F) == VK_RETURN) { CWnd *pNextButton = mParentDiskWiz->GetDlgItem(ID_WIZNEXT); pNextButton->PostMessage(WM_LBUTTONDOWN, MK_LBUTTON, 0); pNextButton->PostMessage(WM_LBUTTONUP, 0, 0); return TRUE; } break; case WM_SYSKEYDOWN: if (tolower(pMsg->wParam & 0x7F) == 'n') { CWnd *pNextButton = mParentDiskWiz->GetDlgItem(ID_WIZNEXT); pNextButton->PostMessage(WM_LBUTTONDOWN, MK_LBUTTON, 0); pNextButton->PostMessage(WM_LBUTTONUP, 0, 0); } break; case WM_KEYUP: SetCapsLockMessageState(); break; } return CPropertyPage::PreTranslateMessage(pMsg); }
void CDownloadMonitorDlg::OnDownloadLibrary() { CWnd* pMainWnd = AfxGetMainWnd(); if ( ! pMainWnd ) return; pMainWnd->PostMessage( WM_COMMAND, ID_VIEW_LIBRARY ); pMainWnd->PostMessage( WM_SYSCOMMAND, SC_RESTORE ); }
void CFileSendDlg::OnBtnFileSendCancel() { // TODO: Add your control notification handler code here if(m_nFileSent == m_nTotalFileCnt) { /* ::EnterCriticalSection(& CFileTransSock::Instance().m_CS); if( (DWORD)m_pSpckObjMap->m_pThreadObj != 0xfeeefeee && (DWORD)m_pSpckObjMap->m_pSockObj != 0xfeeefeee ) { CFileTransSock::Instance().RemoveSocketObj(m_pSpckObjMap->m_pThreadObj, m_pSpckObjMap->m_pSockObj); CFileTransSock::Instance().FreeSocketObj( m_pSpckObjMap->m_pSockObj); CFileTransSock::Instance().RenumberThreadArray(m_pSpckObjMap->m_pThreadObj); //20080707 } ::LeaveCriticalSection(& CFileTransSock::Instance().m_CS); */ shutdown (m_pSpckObjMap->m_pSockObj->s ,SD_BOTH ) ; //closesocket(m_pSpckObjMap->m_pSockObj->s); CWinApp *pApp = AfxGetApp(); CWnd *pMainWnd = pApp->GetMainWnd(); pMainWnd->PostMessage(WM_FILE_SENDDLG_CLOSE, (WPARAM)m_szSockObjID, (LPARAM)0); //CDialog::OnOK(); } else { CFileTransSock::Instance().CancelSendFile(m_pSpckObjMap); /* ::EnterCriticalSection(& CFileTransSock::Instance().m_CS); if( (DWORD)m_pSpckObjMap->m_pThreadObj != 0xfeeefeee && (DWORD)m_pSpckObjMap->m_pSockObj != 0xfeeefeee ) { CFileTransSock::Instance().RemoveSocketObj(m_pSpckObjMap->m_pThreadObj, m_pSpckObjMap->m_pSockObj); CFileTransSock::Instance().FreeSocketObj( m_pSpckObjMap->m_pSockObj); CFileTransSock::Instance().RenumberThreadArray(m_pSpckObjMap->m_pThreadObj); } ::LeaveCriticalSection(& CFileTransSock::Instance().m_CS); */ shutdown (m_pSpckObjMap->m_pSockObj->s ,SD_BOTH ) ; //closesocket(m_pSpckObjMap->m_pSockObj->s); CWinApp *pApp = AfxGetApp(); CWnd *pMainWnd = pApp->GetMainWnd(); pMainWnd->PostMessage(WM_FILE_SENDDLG_CLOSE, (WPARAM)m_szSockObjID, (LPARAM)0); //CDialog::OnOK(); } }
//----------------------------------------------------------------------------- // Purpose: // Input : eDropType - // nFlags - // point - //----------------------------------------------------------------------------- void CGroupList::Drop(DropType_t eDropType, UINT nFlags, CPoint point) { SelectDropTarget(NULL); HTREEITEM hDragItem = m_hDragItem; m_hDragItem = NULL; // // We are dragging. Drop! // if (m_pDragImageList) { m_pDragImageList->DragLeave(this); m_pDragImageList->EndDrag(); delete m_pDragImageList; m_pDragImageList = NULL; } // // Get the group that we were dragging. // CVisGroup *pDragGroup = (CVisGroup *)GetItemData(hDragItem); // // Determine what group was dropped onto. // HTREEITEM hDropItem = HitTest(point); if (hDropItem == hDragItem) { return; } CVisGroup *pDropGroup = NULL; if (hDropItem) { pDropGroup = (CVisGroup *)GetItemData(hDropItem); } if (pDragGroup == pDropGroup) { // Shouldn't happen, but just in case. return; } CWnd *pwndParent = GetParent(); if (pwndParent != NULL) { if (eDropType == DROP_LEFT) { pwndParent->PostMessage(g_uLeftDragDropMsg, (WPARAM)pDragGroup, (LPARAM)pDropGroup); } else { pwndParent->PostMessage(g_uRightDragDropMsg, (WPARAM)pDragGroup, (LPARAM)pDropGroup); } } }
BOOL CDDEServer::Execute(LPCTSTR pszTopic, LPCTSTR pszMessage) { CWnd* pWnd = AfxGetMainWnd(); if ( _tcscmp( pszTopic, _T("URL") ) == 0 ) { theApp.Message( MSG_SYSTEM, IDS_URL_RECEIVED, pszMessage ); CShareazaURL* pURL = new CShareazaURL(); if ( pURL->Parse( pszMessage ) ) { if ( ! pWnd->PostMessage( WM_URL, (WPARAM)pURL ) ) delete pURL; return TRUE; } delete pURL; theApp.Message( MSG_ERROR, IDS_URL_PARSE_ERROR ); } else if ( _tcscmp( pszTopic, _T("TORRENT") ) == 0 ) { theApp.Message( MSG_SYSTEM, IDS_BT_PREFETCH_FILE, pszMessage ); CBTInfo* pTorrent = new CBTInfo(); if ( pTorrent->LoadTorrentFile( pszMessage ) ) { if ( pTorrent->HasEncodingError() ) theApp.Message( MSG_SYSTEM, _T("Possible encoding error detected while parsing torrent") ); CShareazaURL* pURL = new CShareazaURL( pTorrent ); if ( ! pWnd->PostMessage( WM_URL, (WPARAM)pURL ) ) delete pURL; return TRUE; } delete pTorrent; theApp.Message( MSG_ERROR, IDS_BT_PREFETCH_ERROR, pszMessage ); } else if ( _tcscmp( pszTopic, _T("COLLECTION") ) == 0 ) { LPTSTR pszPath = new TCHAR[ _tcslen(pszMessage) + 1 ]; CopyMemory( pszPath, pszMessage, sizeof(TCHAR) * ( _tcslen(pszMessage) + 1 ) ); if ( pWnd->PostMessage( WM_COLLECTION, (WPARAM)pszPath ) ) { return TRUE; } else { delete [] pszPath; } } return FALSE; }
void CSearchInputBox::OnSearchStop() { CString strCaption, strTest; LoadString( strTest, IDS_SEARCH_PANEL_CLEAR ); m_wndStop.GetWindowText( strCaption ); CWnd* pTarget = GetPanel()->GetParent(); if ( strCaption == strTest ) pTarget->PostMessage( WM_COMMAND, ID_SEARCH_CLEAR ); else pTarget->PostMessage( WM_COMMAND, ID_SEARCH_STOP ); }
void ZListTip::OnMouseMove( UINT uFlags, CPoint pt ) { #ifdef DEBUG_ALL TraceRect( "ZListTip::OnMouseMove rectTitle: ", m_rectTitle ); TracePoint( "ZListTip::OnMouseMove pt: ", pt ); #endif if ( m_rectTitle.PtInRect( pt ) == FALSE ) { #ifdef DEBUG_ALL TracePoint( "ZListTip::OnMouseMove PtInRect: ", pt ); #endif #if 0 if ( GetCapture( ) == this ) ReleaseCapture( ); SetWindowPos( 0, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE ); #else Hide( ); #endif // Forward the message ClientToScreen( &pt ); CWnd *pWnd = WindowFromPoint( pt ); if ( pWnd == this ) pWnd = m_pParentWnd; CWnd *pWndTemp = GetFocus( ); if ( pWndTemp != pWnd ) pWnd->SetFocus( ); zLONG lParam = MAKELONG( pt.x, pt.y ); int nHitTest = (int) pWnd->SendMessage( WM_NCHITTEST, 0, lParam ); if ( nHitTest == HTCLIENT ) { pWnd->ScreenToClient( &pt ); lParam = MAKELONG( pt.x, pt.y ); pWnd->PostMessage( WM_MOUSEMOVE, uFlags, lParam ); } else { pWnd->PostMessage( WM_NCMOUSEMOVE, nHitTest, lParam ); } } }
////////////////// // Height changed: Default implementation does the right thing for MFC // doc/view: notify parent frame by posting a WM_SIZE message. This will // cause the frame to do RecalcLayout. The message must be posted, not sent, // because the coolbar could send RBN_HEIGHTCHANGE while the user is sizing, // which would be in the middle of a CFrame::RecalcLayout, and RecalcLayout // doesn't let you re-enter it. Posting guarantees that CFrameWnd can finish // any recalc it may be in the middle of *before* handling my posted WM_SIZE. // Very confusing, but that's MFC for you. // void CCoolBar::OnHeightChange(const CRect& rcNew) { CWnd* pParent = GetParent(); CRect rc; pParent->GetWindowRect(&rc); pParent->PostMessage(WM_SIZE, 0, MAKELONG(rc.Width(),rc.Height())); }
//**************************************************************************************** void CBCGPToolBoxEx::OnClickTool (int nPage, int /*nIndex*/) { ASSERT_VALID (this); CWnd* pOwner = GetOwner (); if (pOwner != NULL) { pOwner->PostMessage ( WM_COMMAND, MAKEWPARAM (GetDlgCtrlID (), BN_CLICKED), (LPARAM) m_hWnd); } for (int i = 0; i < GetPageCount (); i++) { if (i != nPage) { CBCGPToolBoxPage* pPage = GetPage (i); ASSERT_VALID (pPage); pPage->SetSelected (-1); pPage->m_nHighlightedButton = -1; pPage->HighlightButton (-1); } } }
BOOL CListCtrlEditBase::Key_Ctrl(int& nItem,int &nSub) { if(!m_pParentList) return FALSE; short sRet = GetKeyState(VK_CONTROL); // DWORD dwData = m_dwData; // nItem= dwData>>16; // nSub = dwData&0x0000ffff; CWnd *pWnd; nItem = m_nCurrentItem; nSub = m_nCurrentSubItem; sRet = sRet >>15; int nItemCount = m_pParentList->GetItemCount(); if(sRet == 0) { } else { nItem = nItem >=nItemCount-1? 0:nItem+=1; pWnd = m_CtrlMap.GetSubWnd(m_pParentList, nSub); if (pWnd ) pWnd->PostMessage(WM_USER_SHOW_EDIT, nItem, nSub); return TRUE; } return FALSE; }
/////////////////////////////////////////////////////////////////////////////// // OnEvent // Send message to parent window to indicate connection status void CSocketManager::OnEvent(UINT uEvent, LPVOID lpvData) { if (NULL == m_pMsgCtrl) return; CWnd* pParent = m_pMsgCtrl->GetParent(); if (!::IsWindow( pParent->GetSafeHwnd())) return; switch( uEvent ) { case EVT_CONSUCCESS: AppendMessage( _T("Connection Established\r\n") ); break; case EVT_CONFAILURE: AppendMessage( _T("Connection Failed\r\n") ); break; case EVT_CONDROP: AppendMessage( _T("Connection Abandonned\r\n") ); break; case EVT_ZEROLENGTH: AppendMessage( _T("Zero Length Message\r\n") ); break; default: TRACE("Unknown Socket event\n"); break; } pParent->PostMessage( WM_UPDATE_CONNECTION, uEvent, (LPARAM) this); }
void CSkinListBox::OnRButtonUp(UINT nFlags, CPoint point) { CRect rcItem(0,0,0,0); SetSel(-1,FALSE); for (int i =0; i<GetCount(); i++) { GetItemRect(i, &rcItem); if(rcItem.PtInRect(point)) { if( IsSingleSel() ) SetCurSel(i); else SetSel(i); break; } } CWnd *pWnd = GetParent(); if ( (pWnd == NULL) && (pWnd->GetSafeHwnd() != NULL) ) return; pWnd->PostMessage(WM_COMMAND,GetDlgCtrlID(),0); Invalidate(FALSE); __super::OnRButtonUp(nFlags, point); }
/* OnInitialUpdate() */ void CWallBrowserStretchView::OnInitialUpdate(void) { // imposta il puntatore all'immagine per le classi di visualizzazione/manipolazione CImage* pImage = NULL; CWallBrowserDoc* pDoc = (CWallBrowserDoc*)GetDocument(); if(pDoc) pImage = pDoc->GetImage(); m_ImageDraw.SetImage(pImage); m_ImageOperation.SetImage(pImage); // aggiorna la GUI CWnd* pWnd = AfxGetMainWnd(); if(pWnd) { m_pMainFrameStatusBar = (CStatusBar*)pWnd->SendMessage(WM_GET_STATUSBAR,0,0L); if(m_pMainFrameStatusBar) EnableMenu(); pWnd->SendMessage(WM_FILE_SAVE,pDoc ? pDoc->IsModified() : FALSE,0L); pWnd->SendMessage(WM_FILE_SAVE_AS,m_bLoaded,0L); pWnd->SendMessage(WM_FILE_MOVE,m_bHavePicture,0L); pWnd->SendMessage(WM_FILE_DELETE,m_bHavePicture,0L); pWnd->SendMessage(WM_EDIT_COPY,m_bLoaded,0L); pWnd->SendMessage(WM_EDIT_PASTE,m_bLoaded ? ::IsClipboardFormatAvailable(CF_DIB) : FALSE,0L); pWnd->SendMessage(WM_EDIT_UNDO,UndoEnabled(),0L); pWnd->PostMessage(WM_EDIT_REDO,RedoEnabled(),0L); } // classe base CZoomView::OnInitialUpdate(); }
U32 CPluginApp_i::PostMainWndMessage(UINT ulMsg, WPARAM wParam, LPARAM lParam) { U32 ulRet = 0; if(m_hPluginInst) { CWnd* pWnd = AfxGetMainWnd(); if(pWnd) { if(pWnd->PostMessage(ulMsg,wParam, lParam) == FALSE) { ulRet = ERR_WIN32_ERROR_I; } else { ulRet = ERR_OK_I; } } else { ulRet = ERR_NO_INITIALIZATION_I; } } return ulRet; }
void CTDLFindTaskExpressionListCtrl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { int nItem, nCol; GetCurSel(nItem, nCol); if (GetRuleCount() > 0 || nCol == ATTRIB) { // if the user typed an alphanumeric char then begin editing automatically // numeric keys only work for value column if (isalpha(nChar) || (nCol == VALUE && isdigit(nChar))) { EditCell(nItem, nCol); // forward key down on to edit control CWnd* pEdit = GetEditControl(nItem, nCol); if (pEdit) { pEdit->PostMessage(WM_CHAR, nChar, MAKELPARAM(nRepCnt, nFlags)); return; // eat it } } } CInputListCtrl::OnChar(nChar, nRepCnt, nFlags); }
LRESULT CFileSendDlg::OnNoThanksFileTransfer (WPARAM wParam, LPARAM lParam) { /* ::EnterCriticalSection(& CFileTransSock::Instance().m_CS); if( (DWORD)m_pSpckObjMap->m_pThreadObj != 0xfeeefeee && (DWORD)m_pSpckObjMap->m_pSockObj != 0xfeeefeee ) { CFileTransSock::Instance().RemoveSocketObj(m_pSpckObjMap->m_pThreadObj, m_pSpckObjMap->m_pSockObj); CFileTransSock::Instance().FreeSocketObj( m_pSpckObjMap->m_pSockObj); CFileTransSock::Instance().RenumberThreadArray(m_pSpckObjMap->m_pThreadObj); //20080707 } ::LeaveCriticalSection(& CFileTransSock::Instance().m_CS); */ shutdown (m_pSpckObjMap->m_pSockObj->s ,SD_BOTH ) ; //closesocket(m_pSpckObjMap->m_pSockObj->s); AfxMessageBox("상대방이 전송을 취소하였습니다."); CWinApp *pApp = AfxGetApp(); CWnd *pMainWnd = pApp->GetMainWnd(); pMainWnd->PostMessage(WM_FILE_SENDDLG_CLOSE, (WPARAM)m_szSockObjID, (LPARAM)0); //CDialog::OnOK(); return TRUE; }
BOOL CTitleTip::PreTranslateMessage(MSG* pMsg) { CWnd *pWnd; int hittest; switch (pMsg->message) { case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: POINTS pts = MAKEPOINTS( pMsg->lParam ); POINT point; point.x = pts.x; point.y = pts.y; ClientToScreen( &point ); pWnd = WindowFromPoint( point ); if( pWnd == this ) pWnd = m_pParentWnd; hittest = (int)pWnd->SendMessage(WM_NCHITTEST,0,MAKELONG(point.x,point.y)); if (hittest == HTCLIENT) { pWnd->ScreenToClient( &point ); pMsg->lParam = MAKELONG(point.x,point.y); } else { switch (pMsg->message) { case WM_LBUTTONDOWN: pMsg->message = WM_NCLBUTTONDOWN; break; case WM_RBUTTONDOWN: pMsg->message = WM_NCRBUTTONDOWN; break; case WM_MBUTTONDOWN: pMsg->message = WM_NCMBUTTONDOWN; break; } pMsg->wParam = hittest; pMsg->lParam = MAKELONG(point.x,point.y); } Hide(); pWnd->PostMessage(pMsg->message,pMsg->wParam,pMsg->lParam); return TRUE; case WM_KEYDOWN: case WM_SYSKEYDOWN: Hide(); m_pParentWnd->PostMessage( pMsg->message, pMsg->wParam, pMsg->lParam ); return TRUE; } if( GetFocus() == NULL ) { Hide(); return TRUE; } return CWnd::PreTranslateMessage(pMsg); }
void CDlgSuspension::OnExit() { // TODO: Add your command handler code here CWnd *pParent = GetParent(); ASSERT(pParent); pParent->PostMessage(WM_QUIT,0,0); }
//----------------------------------------------------------------------------- // Purpose: Forwards selection change notifications to our parent window. // Input : pNMHDR - // pResult - //----------------------------------------------------------------------------- void CGroupList::OnSelChange(NMHDR *pNMHDR, LRESULT *pResult) { CWnd *pwndParent = GetParent(); if (pwndParent != NULL) { pwndParent->PostMessage(g_uSelChangeMsg, 0, 0); } }
void CGridCtrlList::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: 在此添加消息处理程序代码和/或调用默认值 CWnd* pWnd = GetParent(); pWnd->PostMessage(WM_SETUPGRID_CLICK, 0,0); CBCGPGridCtrl::OnLButtonDown(nFlags, point); }
// 双击 void CXTTreeCtrl::OnLButtonDblClk(UINT nFlags, CPoint point) { HTREEITEM hSelItem = this->GetSelectedItem(); DWORD dwItemData = (DWORD)GetItemData(hSelItem); CWnd *ParentWnd = this->GetParent(); ParentWnd->PostMessage(WM_DBCLK_TREE, (WPARAM)hSelItem, (LPARAM)dwItemData); CTreeCtrl::OnLButtonDblClk(nFlags, point); }
void CTitleTip::ForwardMouseMessage(UINT nFlags, CPoint point, UINT msg, UINT nc_msg) { Hide(); // Forward the message ClientToScreen( &point ); CWnd *pWnd = WindowFromPoint( point ); if ( pWnd == this ) pWnd = m_pParentWnd; int hittest = (int)pWnd->SendMessage(WM_NCHITTEST,0,MAKELONG(point.x,point.y)); if (hittest == HTCLIENT) { pWnd->ScreenToClient( &point ); pWnd->PostMessage( msg, nFlags, MAKELONG(point.x,point.y) ); } else { pWnd->PostMessage( nc_msg, hittest, MAKELONG(point.x,point.y) ); } }
LRESULT CSkinComboBox::OnRButtonUp( WPARAM wParam, LPARAM lParam ) { CWnd *pWnd = GetParent(); if ( (pWnd != NULL) && (pWnd->GetSafeHwnd() != NULL) ) { pWnd->PostMessage(WM_CBO_RBUTTONUP,wParam,lParam); } return 0L; }
void CChildWnd::OnNcRButtonUp(UINT nHitTest, CPoint point) { if ( nHitTest == HTCAPTION ) { CWnd* pWnd = ( Settings.General.GUIMode != GUI_WINDOWED ? this : (CWnd*)GetMainWnd() ); pWnd->PostMessage( WM_CONTEXTMENU, (WPARAM)pWnd->GetSafeHwnd(), MAKELONG( point.x, point.y ) ); return; } CMDIChildWnd::OnNcRButtonUp( nHitTest, point ); }
BOOL CListCtrlEditBase::OnOpen(CListCtrl *pCtrl, NMHDR *pNMHDR) { int nItem, nSubItem; CListCtrlMap map; if (!HitTestEx(pCtrl, pNMHDR, nItem, nSubItem)) return FALSE; CWnd *pWnd = CListCtrlMap::GetSubWnd(pCtrl, nSubItem); if (pWnd == NULL) return FALSE; pWnd->PostMessage(WM_USER_SHOW_EDIT, nItem, nSubItem); return TRUE; }
void PSOrdersTab::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { if (nChar == VK_DELETE) { CWnd* pWnd = AfxGetMainWnd(); int nCurSel = GetCurSel(); if (nCurSel != LB_ERR) pWnd->PostMessage(WM_COMMAND, IDM_DELETE_MOVE, NULL); } CListBox::OnKeyDown(nChar, nRepCnt, nFlags); }
//**************************************************************************************** void CBCGPToolBox::OnClickTool (int /*nPage*/, int /*nIndex*/) { ASSERT_VALID (this); CWnd* pOwner = GetOwner (); if (pOwner != NULL) { pOwner->PostMessage ( WM_COMMAND, MAKEWPARAM (GetDlgCtrlID (), BN_CLICKED), (LPARAM) m_hWnd); } }
LRESULT CSystemTray::OnTrayNotification(UINT wParam, LONG lParam) { //Return quickly if its not for this tray icon if (wParam != m_tnd.uID) return 0L; CMenu menu, *pSubMenu; CWnd* pTarget = AfxGetMainWnd(); // Clicking with right button brings up a context menu if (LOWORD(lParam) == WM_RBUTTONUP) { if (!menu.LoadMenu(m_tnd.uID)) return 0; if (!(pSubMenu = menu.GetSubMenu(0))) return 0; // Make chosen menu item the default (bold font) ::SetMenuDefaultItem(pSubMenu->m_hMenu, m_DefaultMenuItemID, m_DefaultMenuItemByPos); // Display and track the popup menu CPoint pos; GetCursorPos(&pos); pTarget->SetForegroundWindow(); ::TrackPopupMenu(pSubMenu->m_hMenu, 0, pos.x, pos.y, 0, pTarget->GetSafeHwnd(), NULL); // BUGFIX: See "PRB: Menus for Notification Icons Don't Work Correctly" pTarget->PostMessage(WM_NULL, 0, 0); menu.DestroyMenu(); } else if (LOWORD(lParam) == WM_LBUTTONDBLCLK) { // double click received, the default action is to execute default menu item pTarget->SetForegroundWindow(); UINT uItem; if (m_DefaultMenuItemByPos) { if (!menu.LoadMenu(m_tnd.uID)) return 0; if (!(pSubMenu = menu.GetSubMenu(0))) return 0; uItem = pSubMenu->GetMenuItemID(m_DefaultMenuItemID); } else uItem = m_DefaultMenuItemID; pTarget->SendMessage(WM_COMMAND, uItem, 0); menu.DestroyMenu(); } return 1; }