MSDOTnet.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Catching Events

 
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> C Sharp
Author Message
Just close your eyes and



Joined: 11 Aug 2007
Posts: 4

PostPosted: Thu Dec 13, 2007 1:24 pm    Post subject: Catching Events Reply with quote

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?

Archived from group: microsoft>public>dotnet>languages>csharp
Back to top
View user's profile Send private message
Nicholas Paldino [.NET/C#



Joined: 08 Aug 2007
Posts: 71

PostPosted: Thu Dec 13, 2007 4:56 pm    Post subject: Re: Catching Events Reply with quote

Well, you are probably not looking for the correct windows message.

What does your WndProc method look like?


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

"Just close your eyes and see"
wrote in message @microsoft.com...
> 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?
Back to top
View user's profile Send private message
Just close your eyes and



Joined: 11 Aug 2007
Posts: 4

PostPosted: Thu Dec 13, 2007 2:20 pm    Post subject: Re: Catching Events Reply with quote

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;
}
}
Back to top
View user's profile Send private message
Just close your eyes and



Joined: 11 Aug 2007
Posts: 4

PostPosted: Mon Dec 17, 2007 9:06 am    Post subject: Re: Catching Events Reply with quote

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);
}
}

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Catching an Exception in VB .NET I'm collecting information from several remote machines. Until I try to access the machine through WMI, I don't know if it supports WMI. If the remote host does not support WMI, then I'm getting and unhandled exception error: ----- An unhandled exceptio

Catching the paste message Hello all. I don't know if this is the right newsgroup to post this message, so sorry for any I have a class inheriting from which contraints user input to only numeric digits. It works well until user paste som

problem catching @raiserror in odbc I am using the .net odbc data providder to execute a stored procedure on Sql Server 2000. The stored procedure uses @raiserror in case of an error. However, when I try to catch the exception in c# code I can’t get it. Any ideas? (before anyone suggest u

Catching a change event on a bound cell on a datagrid I have a datagrid which I have bound to a DataTable using the properties. It displays exactly how I would like it - offering sorting and re-ordering and hiding columns. When a background process or calculation changes the data that t

Static Events Is this a good or bad thing.. I made this control that contains a collection of types, and its up to the caller to register a type in this controls collection. I want to render the contents as it arrives via a method call on these registered types so I ha
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> C Sharp All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group