Hey all,

Im having problems with a dll im coding. For some reason the following code doesnt work correctly:

Code:
LRESULT CALLBACK HookProcedure (int nCode, WPARAM wParam, LPARAM lParam )
{                
    if (nCode == HCBT_KEYSKIPPED)
    {        
system("echo hcbt_keyskipped >> test.txt");
                  ::PostMessage(mywindow, MSG_WM_KEYDOWN, wParam, lParam);
        
    }
    else if (nCode == HCBT_SETFOCUS)
    {
system("echo hcbt_setfocus >> test.txt");
        ::PostMessage(mywindow, MSG_WM_SETFOCUS, wParam, lParam);
}
return CallNextHookEx( 0, nCode, wParam, lParam);
}
As you can see both of the IF statements use the system call to output a message to test.txt saying when the contents of the IF statements are being executed. This works correctly for setfocus but not keyskipped and i cant understand why because essentially they are the same code.

Note. This isnt a problem with the message MSG_WM_KEYDOWN or the mywindow variable. It also isnt a problem with my includes (i think!).

The way the setfocus works is when i run the dll whenever i change window it writes to the test.txt file showing it has registered the change of window focus, however when i press a key it should write to a the test.txt file showing it has registered the keypressing but it doesnt which implies IF(nCode == HCBT_KEYSKIPPED) is never true, but it should be. Im really stumped on this so any help would be appreciated.

Thanks

Mike

NOTE.

This might be important. The above code works fine when ran on some computers but not others, which seems strange as they are all running winxp pro. This suggests that the coding is fine but the OS is set up differently on some computers allowing it to work but not on others... If anyone knows why this is so then please say. Thanks