I need to remap some of keys like Left Alt but i just disable it so code for disable Left Alt look like this:
LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == HC_ACTION)
{
KBDLLHOOKSTRUCT* p = (KBDLLHOOKSTRUCT*) lParam;
if (p->vkCode == VK_LMENU) return 1;
}
return CallNextHookEx(hHook, nCode, wParam, lParam);
}
So I try to remap Left Alt to Left Ctrl and use function like keybd_event
and SendMessageA
but didn't get nothing.
LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == HC_ACTION)
{
KBDLLHOOKSTRUCT* p = (KBDLLHOOKSTRUCT*) lParam;
if (p->vkCode == VK_LMENU)
{
keybd_event(VK_CONTROL, 0, 0, 0);
// or use this is sameSendMessageA(0, WM_KEYUP, VK_CONTROL, 0);
}
}
return CallNextHookEx(hHook, nCode, wParam, lParam);
}
How to remap Left Alt to Left Ctrl?
This is a way to remap Alt to Ctrl works great. Don't forget the default parameter switches back to alt if you do not define wParam may just be my computer well give it a try