CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 1999
    Location
    Tel-Aviv, Israel
    Posts
    4

    How to write a proper message hook?

    Hi !

    I need to set a message hook to another application.
    My HookProc is sitting in a Dll, and look like this:

    int FAR PASCAL MsgFilterFunc (int nCode, WORD wParam, DWORD lParam )

    Then I pass it to SetWindoshookEx:

    hhookMsgFilterHook = SetWindowsHookEx (WH_MSGFILTER, MsgFilterFunc, hInstance, 0);

    The compiling error that I get is:

    SetWindowsHookEx : cannot convert parameter 2 from 'long' to 'long (__stdcall *)(int,unsigned int,long)'

    Please, someone?!


  2. #2
    Join Date
    Jun 1999
    Posts
    1,786

    Re: How to write a proper message hook?

    Hello
    Declare you function like LRESULT CALLBACK YourProcName(int nCode, WPARAM wParam, LPARAM lParam)

    instead of int FAR PASCAL YourProcName...




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured