Catching Events

  • Thread starter Thread starter Just close your eyes and see
  • Start date Start date
J

Just close your eyes and see

Hello All
I am trying to catch a right button down event for a control before the form
sends it to this control; I tried to do that through overriding the WndProc
But it fails!
Is there any way to do that?
 
Well, you are probably not looking for the correct windows message.

What does your WndProc method look like?
 
const int WM_RBUTTONDOWN = 0x204;
const int WM_RBUTTONUP = 0x205;

protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_RBUTTONDOWN: MessageBox.Show("Down");
break;
case WM_RBUTTONUP: MessageBox.Show("Up");
break;
default: base.WndProc(ref m);
break;
}
}
 
i did it using MFC , but i am still working around to make it using C#
here is the MFC code using a message called "PreTranslateMessage"


const int RBUTTONDOWN = 0x204;
const int RBUTTONUP= 0x205;
BOOL Cmfc01App::PreTranslateMessage(MSG* pMsg)
{
switch (pMsg->message)
{
case RBUTTONDOWN:return true;
case RBUTTONUP:return true;
default:CWinApp::PreTranslateMessage(pMsg);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top