leooo007
04-03-11, 03:53 AM
Hi good morning to the entire community!
Anyone can help me? I'm looking for a source to lock the keys F5, F6, F7ect .. keyboard.
On another forum I found the following:
HHOOK g_hHookKbdLL = NULL;
LRESULT CALLBACK KeyHookLL(int nCode, WPARAM wp, LPARAM lp);
BOOL APIENTRY DllMain(HINSTANCE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
g_hHookKbdLL = SetWindowsHookEx(WH_KEYBOARD_LL,KeyHookLL, hModule, 0);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
UnhookWindowsHookEx(g_hHookKbdLL);
g_hHookKbdLL = NULL;
break;
}
return TRUE;
}
LRESULT CALLBACK KeyHookLL(int nCode, WPARAM wp, LPARAM lp)
{
KBDLLHOOKSTRUCT *pkh = (KBDLLHOOKSTRUCT *) lp;
if (nCode==HC_ACTION)
{
if(pkh->vkCode==VK_F1) // Bloquear F1
{
return 1;
}
}
return CallNextHookEx(g_hHookKbdLL, nCode, wp, lp);
}
This source is supposed to lock the keys on the keyboard, but I can not make it work.
My OS is: windows xp sp3.
Greetings, thank you very much for reading my message.
Sorry for the language, not read or write in Vietnamese, so I use google to translate the text, I'm from Argentina =)
Anyone can help me? I'm looking for a source to lock the keys F5, F6, F7ect .. keyboard.
On another forum I found the following:
HHOOK g_hHookKbdLL = NULL;
LRESULT CALLBACK KeyHookLL(int nCode, WPARAM wp, LPARAM lp);
BOOL APIENTRY DllMain(HINSTANCE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
g_hHookKbdLL = SetWindowsHookEx(WH_KEYBOARD_LL,KeyHookLL, hModule, 0);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
UnhookWindowsHookEx(g_hHookKbdLL);
g_hHookKbdLL = NULL;
break;
}
return TRUE;
}
LRESULT CALLBACK KeyHookLL(int nCode, WPARAM wp, LPARAM lp)
{
KBDLLHOOKSTRUCT *pkh = (KBDLLHOOKSTRUCT *) lp;
if (nCode==HC_ACTION)
{
if(pkh->vkCode==VK_F1) // Bloquear F1
{
return 1;
}
}
return CallNextHookEx(g_hHookKbdLL, nCode, wp, lp);
}
This source is supposed to lock the keys on the keyboard, but I can not make it work.
My OS is: windows xp sp3.
Greetings, thank you very much for reading my message.
Sorry for the language, not read or write in Vietnamese, so I use google to translate the text, I'm from Argentina =)