Re: как в CEdit поймать WM_PASTE ?
От: Игорь Вартанов Ниоткуда  
Дата: 26.04.02 07:26
Оценка:
Здравствуйте Сергей, Вы писали:

С>Люди, есть класс производный от CEdit. Не могу поймать в нем WM_PASTE.

С>
С>BOOL MyEdit::PreTranslateMessage(MSG* pMsg) 
С>{
С>    // TODO: Add your specialized code here and/or call the base class
С>    if(pMsg->message == WM_PASTE)
С>        AfxMessageBox("PreTranslate");
С>        .........................
С>}
С>

С>молчит как рыба. В чём мой баг?

WM_PASTE посылается прямиком, не через очередь сообщений.

Придется добавить руками:

// MyEdit.h
. . .
protected:
    //{{AFX_MSG(CMyEdit)
        // NOTE - the ClassWizard will add and remove member functions here.
    //}}AFX_MSG
    afx_msg LRESULT OnPaste(WPARAM wParam, LPARAM lParam);  // !!!

    DECLARE_MESSAGE_MAP()
}


// MyEdit.cpp
. . .
BEGIN_MESSAGE_MAP(CMyEdit, CEdit)
    //{{AFX_MSG_MAP(CMyEdit)
        // NOTE - the ClassWizard will add and remove mapping macros here.
    //}}AFX_MSG_MAP
    ON_MESSAGE( WM_PASTE, OnPaste ) // !!!
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyEdit message handlers

LRESULT CMyEdit::OnPaste(WPARAM /*wParam*/, LPARAM /*lParam*/) // !!!
{
    MessageBox( _T("Paste") );
    return 0;
}
---
С уважением,
Игорь
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.