Thread: problem disabling ctrl-esc

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    3

    problem disabling ctrl-esc

    Hi,

    I have extremly annoying problem that bothers me for a week now and I was unable to find any answer on the web regarding the subject.

    Program that I wrote disables ctrl-esc combination while it's running. But when it executes an external program the combination gets renabled during the execution of external program.

    I have hooked up my keyboard handler using SetWindowsHookEx and use _spawnl to run external program.

    Thanks,

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Are you installing a system wide hook or a thread specific hook?

    gg

  3. #3
    Registered User
    Join Date
    Jul 2003
    Posts
    3
    I am installing the system wide function. I have attached the code of a dll file with this message.

    In a main program I use the following code for invoking dll function that installs keyboard hook:

    HMODULE libh = LoadLibrary("KeyboardHook.dll");
    FARPROC kbdproc = GetProcAddress(libh, "RemoveHook");
    kbdproc();

    Maybe the problem is because I am using MFC DLL?

  4. #4
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    Try and use scancodes rather than virtual key codes, as some vk codes are blocked at certain times by the system, but the scancodes are not blocked (or at least, that's been my experience using keyboard hooks under Windows XP).

    By "blocked" I mean of course that the virtual key part of the message is zero, whilst the scancode part is still valid.

    Also, try and use CreateProcess rather than spawn.

  5. #5
    Registered User
    Join Date
    Jul 2003
    Posts
    3
    Well, the problem is definitely not in virtual codes because during the execution of external program the hook function is never used. Like it is thread-specific, which is probably true but I can't figure it why.

    I have tried CreateProcess and other similiar functions with no results. But if it is system wide hook it should not matter at all.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  4. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM