MouseEventArgs from a message

E

Ernst Sauer

Hello,

how can I get the MouseEventArgs e from a message

public class MyMessageFilter : IMessageFilter
{
public bool PreFilterMessage(ref Message m)
{
MouseEventArgs e = ??;

if (m.Msg == 0x20a) // MouseWheel
{
// hier I need e.delta;

return true;
}
return false;
}
}

Thanks
Ernst
 
E

Ernst Sauer

Am 11.01.2013 03:45, schrieb Peter Duniho:
....
But you don't explain why exactly you're using
message filtering for processing in the first place,

and for the first time, so I have almost no
knowledge about messages, LParam ...
so it's hard to say for sure.

Inside Form1 I have a Form2 with a drawing area.
When the mouse is in this are I will zoom this (only this) drawing
with the use of MouseWheel, but without scrolling the Form2-Window.

For this I created the MyMessageFilter class.

All I want in PreFilterMessage(ref Message m)
is the value Delta for the MouseWheel,
especially if the value is positive or negative.

Thanks,
Ernst
 
B

bradbury9

El jueves, 10 de enero de 2013 22:34:29 UTC+1, Ernst Sauer escribió:
Hello,



how can I get the MouseEventArgs e from a message



public class MyMessageFilter : IMessageFilter

{

public bool PreFilterMessage(ref Message m)

{

MouseEventArgs e = ??;



if (m.Msg == 0x20a) // MouseWheel

{

// hier I need e.delta;



return true;

}

return false;

}

}



Thanks

Ernst

Never used message filters, but in this sample they acces the mouse click. Maybe you can use similar code to access mousewheel, checking Message.Msg property with another value.

http://blogs.msdn.com/b/csharpfaq/archive/2004/10/20/245412.aspx


Hope it help ;-)
 
B

bradbury9

El viernes, 11 de enero de 2013 13:26:16 UTC+1, bradbury9 escribió:
El jueves, 10 de enero de 2013 22:34:29 UTC+1, Ernst Sauer escribió:




Never used message filters, but in this sample they acces the mouse click.. Maybe you can use similar code to access mousewheel, checking Message.Msgproperty with another value.



http://blogs.msdn.com/b/csharpfaq/archive/2004/10/20/245412.aspx





Hope it help ;-)

OK, seems mousewheel is 0x020E http://msdn.microsoft.com/es-es/library/windows/desktop/ms645614(v=vs.85).aspx
 

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

Top