Click here to Skip to main content
15,893,337 members
Home / Discussions / C#
   

C#

 
GeneralRe: real challenge! How to implicitly override a Win form method Pin
Marc Clifton18-May-05 4:21
mvaMarc Clifton18-May-05 4:21 
GeneralRe: real challenge! How to implicitly override a Win form method Pin
jinzhecheng18-May-05 4:41
jinzhecheng18-May-05 4:41 
GeneralRe: real challenge! How to implicitly override a Win form method Pin
Tom Larsen18-May-05 4:48
Tom Larsen18-May-05 4:48 
GeneralRe: real challenge! How to implicitly override a Win form method Pin
jinzhecheng18-May-05 5:04
jinzhecheng18-May-05 5:04 
GeneralRe: real challenge! How to implicitly override a Win form method Pin
Marc Clifton18-May-05 5:41
mvaMarc Clifton18-May-05 5:41 
GeneralRe: real challenge! How to implicitly override a Win form method Pin
S. Senthil Kumar18-May-05 5:48
S. Senthil Kumar18-May-05 5:48 
GeneralRe: real challenge! How to implicitly override a Win form method Pin
jinzhecheng18-May-05 6:21
jinzhecheng18-May-05 6:21 
GeneralRe: real challenge! How to implicitly override a Win form method Pin
Marc Clifton18-May-05 6:53
mvaMarc Clifton18-May-05 6:53 
A delegate is a lot simpler than a proxy. Smile | :)

And delegates/events can have a return type, it's just not standard. Smile | :)

So yes, the real way to do it is to define your own specialized EventArgs class that has the "handled" flag.

But yes, if you want something that can hook a form that doesn't implement WndProc and gives you a way to hook it, then you have to do something like this:

PreFilter preFilter=new PreFilter();
Application.AddMessageFilter(preFilter);
...
class PreFilter : IMessageFilter
{
  public bool PreFilterMessage(ref Message m)
  {
    // ...
  }
}


That may be more what you're looking for. You can then test if the message's HWnd is the same as the Form's hWnd that you want to hook, using:

form.Handle

which should be the same thing as the HWnd value.

Marc

MyXaml
Advanced Unit Testing
YAPO
GeneralRe: real challenge! How to implicitly override a Win form method Pin
18-May-05 6:59
suss18-May-05 6:59 
GeneralRe: real challenge! How to implicitly override a Win form method Pin
DavidNohejl18-May-05 6:55
DavidNohejl18-May-05 6:55 
Generaldeleting particular node element from xml file through LOOP Pin
ksanju100018-May-05 4:13
ksanju100018-May-05 4:13 
QuestionAVISaveOptions Invisible Font? Pin
Member 190300618-May-05 4:07
Member 190300618-May-05 4:07 
GeneralSelecting row Index of datagrid Pin
Ashishhere18-May-05 3:34
Ashishhere18-May-05 3:34 
GeneralRe: Selecting row Index of datagrid Pin
Marc Clifton18-May-05 4:17
mvaMarc Clifton18-May-05 4:17 
GeneralComboBox - remove focus Pin
NortonC18-May-05 2:05
NortonC18-May-05 2:05 
GeneralRe: ComboBox - remove focus Pin
Marc Clifton18-May-05 2:12
mvaMarc Clifton18-May-05 2:12 
GeneralRe: ComboBox - remove focus Pin
NortonC18-May-05 2:19
NortonC18-May-05 2:19 
GeneralProject Type in VS 2005 Pin
rathishps18-May-05 1:05
rathishps18-May-05 1:05 
GeneralGet High Byte of Int16 Pin
zuschauer198018-May-05 0:32
zuschauer198018-May-05 0:32 
GeneralRe: Get High Byte of Int16 Pin
Marc Clifton18-May-05 1:11
mvaMarc Clifton18-May-05 1:11 
GeneralRe: Get High Byte of Int16 Pin
S. Senthil Kumar18-May-05 1:21
S. Senthil Kumar18-May-05 1:21 
GeneralRe: Get High Byte of Int16 Pin
Mike Dimmick18-May-05 1:42
Mike Dimmick18-May-05 1:42 
Generaltwo's complement Pin
zuschauer198018-May-05 1:46
zuschauer198018-May-05 1:46 
GeneralRe: two's complement Pin
Sebastian Schneider18-May-05 3:50
Sebastian Schneider18-May-05 3:50 
GeneralRe: two's complement Pin
zuschauer198018-May-05 22:49
zuschauer198018-May-05 22:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.