문제

We have an MFC SDI application in VS2010 with a CMFCToolBar containing a CMFCToolBarEditBoxButton. Is there a way to handle the paste event when a user pastes something into that edit box?

We handle ON_COMMAND(ID_EDIT_PASTE, OnEditPaste) in the main window but the paste message isn't getting raised when focus is inside the CMFCToolBarEditBoxButton.

도움이 되었습니까?

해결책

From the MFC Sources [afxtoolbareditboxbutton.cpp], it looks like the 'Paste()' function of the underlying CMFCToolBarEditCtrl is called directly during Ctrl-V, the 'Paste()' member function just sends WM_PASTE to the edit window.

Could do try making a handler for WM_PASTE?

This SO Answer has an example of how to do this.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top