我来解决如何响应CEdit右键按下的消息:
假设对话框CTestDlg上有一个资源ID是IDC_EDIT1的Edit。我想要鼠标右键单击它时响应,弹出一MessageBox。
做法如下:重栽PreTranslateMessage。
BOOL CTestDlg::PreTranslateMessage(MSG* pMsg) 
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message ==WM_RBUTTONDOWN)
{   
CEdit* pEdit=(CEdit*)GetDlgItem(IDC_EDIT1);
if(pMsg->hwnd ==pEdit->GetSafeHwnd())
{
MessageBox("EDIT Right ButtonDown");
}
}
return CDialog::PreTranslateMessage(pMsg);
}至于如何把相关操作对应到toolbar上,我还没成功!
另外,你可以用SPY++查找当你按下PASET系统发出的消息,再进一步处理