Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

get paste and cut event in CEditView

In my program I must do something when do paste or cut in Editview.

But I found When Right mouse click in the view, it will show a pop menu which is not my menu. In the pop menu,it can paste and cut too! I can not detect the paste and cut event from the menu.

How can I get the event from the pop menu.
0
dead_fish
Asked:
dead_fish
  • 2
1 Solution
 
AlexFMCommented:
Try to handle WM_COPY and WM_PASTE messages in CEditView.
0
 
dead_fishAuthor Commented:
how?
0
 
williamcampbellCommented:
Use pretranslate message

BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
   if ((GetDlgItem(IDC_EDIT1)->GetSafeHwnd() == pMsg->hwnd) &&     
        ((pMsg->message == WM_COPY) || (pMsg->message == WM_PASTE) )
   {
         // Do you stuff here
         return TRUE; //don't process
   }
   else
   {
        // it's either not our box or another message...
        return CDialog::PreTranslateMessage(pMsg);
   }
}
0
 
dead_fishAuthor Commented:
I could not hands WM_CUT,WM_PASTE messages in PreTranslateMessage(MSG* pMsg) or


but I hands these in LRESULT CDsbView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam).
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now