Results 1 to 6 of 6

Thread: Catching mouse events

  1. #1
    Senior Member
    Join Date
    Jul 2003
    Posts
    166

    Lightbulb Catching mouse events

    Hello,
    I'm interested how to catch mouse events with c++. I tried to use SetWindowsHookEx, but I catch only the events when the cursor is in my app.
    My OS is Windows XP and I use Borland C++ Builder 6.0
    BGDevS
    [gloworange]www.peaksoft.info [/gloworange]

  2. #2
    Sounds like your code is creating a local hook instead of a remote one...Did you include your hook procedure in a DLL (Global hooks require the procedure to be in a DLL)? It's also very import to use shared memory sections correctly when working with global hooks...There's a lot of information out there on this sort of thing, you just have to google for it...
    We are a generation without a middle. We have no great war or depression. Our war is a spiritual one, our depression is our lives. We were all raised to believe that we\'ll all be millionaires and rockstars - But we won\'t.
    And we are slowly learning this fact...And we are VERY pissed off about it!

  3. #3
    Senior Member
    Join Date
    Jul 2003
    Posts
    166
    I search for this, but found VB code and components. You say that I must include my hook procedure in dll. And that procedure to catch and work with the hooks?
    BGDevS
    [gloworange]www.peaksoft.info [/gloworange]

  4. #4
    Senior Member Deeboe's Avatar
    Join Date
    Nov 2005
    Posts
    185
    Have you tried a mouse trap?

    I'm sorry, I just couldn't help myself. Just thought I would help brighten the Monday morning.

    -Deeboe
    If you know the enemy and know yourself, you need not fear the result of a hundred battles. If you know yourself but not the enemy, for every victory gained you will also suffer a defeat. If you know neither the enemy nor yourself, you will succumb in every battle.
    - Sun Tzu, The Art of War

    http://tazforum.**********.com/

  5. #5
    Your DLL would contain some basic functions like

    InstallHook
    UninstallHook
    HookProc

    The first two are self explanitory, HookProc is the code you want to execute qhwn your hook is called...
    We are a generation without a middle. We have no great war or depression. Our war is a spiritual one, our depression is our lives. We were all raised to believe that we\'ll all be millionaires and rockstars - But we won\'t.
    And we are slowly learning this fact...And we are VERY pissed off about it!

  6. #6
    Senior Member treanglin's Avatar
    Join Date
    Dec 2003
    Posts
    111
    What are you catching mouse events for?
    "Do you know why the system is slow?" they ask

    "It's probably something to do with..." I look up today's excuse ".. clock speed"
    -BOFH

Posting Permissions

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