LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == HC_ACTION)
{
KBDLLHOOKSTRUCT* p = (KBDLLHOOKSTRUCT*) lParam;
if (p->vkCode == VK_LMENU)
{
if (wParam == WM_KEYDOWN)
keybd_event(VK_LCONTROL, 0x1D, KEYEVENTF_EXTENDEDKEY | 0, 0 );
else if (wParam == WM_KEYUP)
keybd_event( VK_LCONTROL, 0x1D, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
return 1;
}
}
return CallNextHookEx(hHook, nCode, wParam, lParam);
}
These lines will solve your problem if you press LALT then it will act as LCTRL i.e. LCTRL key will be depressed and if you release LALT, LCTRL will be released.