Hi List,

I am creating a control which can be added onto a Windows form. To
capture the mousehover event i have implemented the IMessageFilter
interface in System.windows.forms namespace.
Documentation says that the Addmessagefilter function in Application
class has to be placed in main before the Application.Run statement. In
my case this is not possible and i am stuck.

here;s a snippet :

public class XYZ : IMessageFilter
{

public XYZ()
{       }

public bool PreFilterMessage(ref System.Windows.Forms.Message m)
{
        if (m.Msg == (int)WindowsMessages.WM_MOUSEHOVER)
        {
                // blah blah
                return true;
        }
        else if (m.Msg == (int)WindowsMessages.WM_MOUSELEAVE)
        {
                // blah blah
                return true;
        }
        return false;
}

}


Now to register this as a message filter i need to say
Application.AddMessageFilter( new XYZ() ); in the main function of the
form !  Which obviously is not under my control ...
i need a way to sort this out ...

I tried adding the AddMessageFilter function in the constructor of the
class .. but it works only once .. i.e., message filter is not called
more than once ...

Any kind of help will do ...

Regards,

Vijay

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
You may be interested in Guerrilla .NET, 24 March 2003, in London
http://www.develop.com/courses/gdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to