Results 1 to 4 of 4

Thread: System-scope hooks (I know it sounds ugly, please at least read?)

  1. #1

    Thread Starter
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892

    Thumbs down

    Blah. I am creating an application, and I need to move the mouse cursor and at the same time know when the mouse itself has been moved. So I figure, it would be neat if I moved the cursor with SetCursorPos and then used a system-scope WH_MOUSE hook to know when the mouse itself was moved, clicked, wheel-rolled, etc.

    Only problem is, as you can already guess, you need a DLL library to use system-scope hooks. And I don't have anything which can create that. Except, oh no, anything but that, Visual C++.

    I don't know that language very well, and I haven't used it in quite some time, so... Could anyone please help me with the code?

    I need something like this:
    Code:
    Public Declare Function GetAddressOfMouseProc Lib "MySqueezyDLL" () As Long
    Public Declare Function GethInstanceOfMySqueezyDLL Lib "MySqueezyDLL" () As Long
    
    Public Declare Sub InitializeDLL Lib "MySqueezyDLL" (ByVal hAddressOfMySqueezyCallbackRoutine As Long)
    
    Public Sub MySqueezyCallbackRoutine()
        ' This is just a callback routine that doesn't need to return anything or receive any values
        ' It's just a notification OK???
    End Sub
    Inside the DLL would be a cute little MouseProc that would just call MySqueezyCallbackRoutine and return the value returned by CallNextHookEx... I don't need anything fancier!

  2. #2

    Thread Starter
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892

    Angry Go on, go on...

    Reply! I know you have a valid and helpful answer!!!

  3. #3
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    I can't help you with the C stuff, but if you only want to capture Mouse movements, you could use a journal hook. This is the only system wide hook that doesn't have to live in a C dll, so you can use it with vb.

    Have a look at this post:
    http://forums.vb-world.net/showthrea...threadid=15494

  4. #4

    Thread Starter
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892

    Talking Thank you, thank you, thank you, etc.

    I knew that the two Journal Hooks didn't need to be in a DLL Library to work system-scope.
    I just didn't even think for a second about them!
    THANKS! THE WORLD IS SAVED!

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