Thread: hooks

  1. #1
    Registered User canine's Avatar
    Join Date
    Sep 2001
    Posts
    125

    hooks

    Is there any way at all in which i can have a program find a right click even if any other program is open and active without using a dll file?
    In a perfect world every dog would have a home and every home would have a dog.
    Visit My Web Site, Canine Programming
    I use Win32 API

  2. #2
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    do you know the name of the window (title)?

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: hooks

    Originally posted by canine
    Is there any way at all in which i can have a program find a right click even if any other program is open and active without using a dll file?
    No..... because to do this you need a global-systemwide hook......with this, an item of code (that you design) is run by a thread before the message is dispached to a WndProc...

    Therefore to offer this code to the OS to allow it to be used, it must be housed in a seperate module.....which is best done with a dll

  4. #4
    Registered User canine's Avatar
    Join Date
    Sep 2001
    Posts
    125
    ok but is there much more complications with handling that dll
    In a perfect world every dog would have a home and every home would have a dog.
    Visit My Web Site, Canine Programming
    I use Win32 API

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by canine
    ok but is there much more complications with handling that dll
    Yes & no ......depends on what you want to do.....


    Sorry to be vague, but its not very easy to answer

  6. #6
    Registered User canine's Avatar
    Join Date
    Sep 2001
    Posts
    125
    I basicly just want some code to be executed when a right click is pressed anywhere
    In a perfect world every dog would have a home and every home would have a dog.
    Visit My Web Site, Canine Programming
    I use Win32 API

  7. #7
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    Well what's the issue with having a DLL?

  8. #8
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by -KEN-
    Well what's the issue with having a DLL?
    From MSDN under SetWindowsHookEx()

    The system hooks are a shared resource, and installing one affects all applications. All system hook functions must be in libraries.
    Originally posted by canine
    I basicly just want some code to be executed when a right click is pressed anywhere
    Look on my site....under "remote keyboard hook" there's a little prog I wrote to read all keystrokes and relay them to a server.....

    Your code would be simpler....

  9. #9
    canine
    Guest
    uh fordy this may sound stupid but i have never used a dll your example int the source of the dll and some time made it seem not so hard
    but when i try to compile my dll it says declaration santax error at DLLExport int Set Globals and then for some reason displays the code #define DLLExport extern "C" __declspec(dllexport) this was written at the top i know.
    I have absolutely no idea what any of it means so if u have any ideas they wouyld be appreciated

  10. #10
    canine
    Guest
    uh scratch that last post i cant get any of it to work. i know a full example is asking a lot but i have no other ideas.

  11. #11
    Registered User johnnie2's Avatar
    Join Date
    Aug 2001
    Posts
    186
    "Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Generating Window Procedure mouse WPARAM from Hooks
    By seaders in forum Windows Programming
    Replies: 0
    Last Post: 03-24-2009, 09:43 AM
  2. Windows Hooks for global mouse detection
    By JJFMJR in forum Windows Programming
    Replies: 8
    Last Post: 08-12-2008, 08:04 AM
  3. Hooks
    By Insenic in forum Windows Programming
    Replies: 4
    Last Post: 02-08-2006, 03:56 PM
  4. Listing all hooks?
    By kryptkat in forum Windows Programming
    Replies: 4
    Last Post: 11-17-2005, 04:55 PM
  5. Detecting Keyboard Hooks
    By KinoCode in forum Windows Programming
    Replies: 2
    Last Post: 01-17-2003, 11:24 AM