Hooks

This is a discussion on Hooks within the Windows Programming forums, part of the Platform Specific Boards category; I am currently wolking on a on a C project to convert QWERTY keystrokes to DVORAK keystrokes for the system. ...

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    13

    Hooks

    I am currently wolking on a on a C project to convert QWERTY keystrokes to DVORAK keystrokes for the system. I googled and found I have to use a global keybeard hook, but I am not exactly sure how to get it working. Allot of the resourses I found were not any good. what exactly do I have to do to get the hook set up.

    And I have never written or used a DLL in C before. Are there any resourses that you have in mind that may teach me that? (at least the basics so I can write the needed DLL for this project) I googled and found several different explinations as to wirting them, which all said to do different things, and none explained loading them in C(but rather in other languages). So I know neither how to write them or lead them.

    I hope you under stand what I am asking. Not to have you write even parts of the program for me, but explain how to use (keyboard) hooks, and use/write DLLs.
    Last edited by Insenic; 02-03-2006 at 02:32 PM.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    You already asked this question here, and I told you in that thread why global hooks wouldn't work for you.

  3. #3
    Registered User
    Join Date
    May 2005
    Posts
    13
    Quote Originally Posted by bithub
    You already asked this question here, and I told you in that thread why global hooks wouldn't work for you.
    Yes, but I am still looking to do it as a learning experience. I have a windows PC here with admin privliges that I can test it on.

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    Hooks are set with the SetWindowsHook() or SetWindowsHookEx() function. Read the MSDN documentation for information on how to use the function.

    When you call SetWindowsHook(), your hook gets added to a global chain of hooks. Since this chain must be persistant (even when your application is not running) a hook procedure must be in a DLL. A tutorial on how to make DLL files is outside the scope of a message board post, but you can get plenty of information from google on that.

    I wrote up a little example on how to create and set a keyboard hook on this board once. If you do a board search, you can probably find it.

  5. #5
    Registered User
    Join Date
    May 2005
    Posts
    13
    Quote Originally Posted by bithub
    Hooks are set with the SetWindowsHook() or SetWindowsHookEx() function. Read the MSDN documentation for information on how to use the function.

    When you call SetWindowsHook(), your hook gets added to a global chain of hooks. Since this chain must be persistant (even when your application is not running) a hook procedure must be in a DLL. A tutorial on how to make DLL files is outside the scope of a message board post, but you can get plenty of information from google on that.

    I wrote up a little example on how to create and set a keyboard hook on this board once. If you do a board search, you can probably find it.
    Thanks. I saw the SetWindowsHook function in what I did read on them. And somewhat how to use them, but not a great deal I will defenatly seargh for your example. I hope it isn't burried too far. I could probably ask about the C DLL in the general C board. I will later if I cant find anything more in my searches.

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, 10:43 AM
  2. Windows Hooks for global mouse detection
    By JJFMJR in forum Windows Programming
    Replies: 8
    Last Post: 08-12-2008, 09:04 AM
  3. Listing all hooks?
    By kryptkat in forum Windows Programming
    Replies: 4
    Last Post: 11-17-2005, 04:55 PM
  4. Problem with invoke of hooks DLL
    By arti_valekar in forum Windows Programming
    Replies: 1
    Last Post: 03-02-2005, 03:06 PM
  5. Detecting Keyboard Hooks
    By KinoCode in forum Windows Programming
    Replies: 2
    Last Post: 01-17-2003, 11:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21