You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The hook succeeds and messages get sent correctly when keys are pressed, but does it somehow get processed differently in ProcessMessage than a normal messaging thread?
// Create messenging thread.
m_pHookThread = new std::thread(&CDirectXWrapper::Hook, this);
m_pHookThread->detach();
void CDirectXWrapper::Hook()
{
// Install hooks
m_hHook = SetWindowsHookEx(WH_KEYBOARD_LL, [](const int nCode, const WPARAM wParam, const LPARAM lParam) {
switch (wParam)
{
case WM_ACTIVATEAPP:
Keyboard::ProcessMessage(nCode, wParam, lParam);
break;
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
case WM_KEYUP:
case WM_SYSKEYUP:
Keyboard::ProcessMessage(nCode, wParam, lParam);
break;
}
return CallNextHookEx(m_hHook, nCode, wParam, lParam);
}, NULL, 0);
if (m_hHook == NULL)
{
std::wcout << "Keyboard hook failed!" << std::endl;
}
else
{
std::wcout << "Keyboard hooked!" << std::endl;
}
// Messenging loop.
while (GetMessage(NULL, NULL, 0, 0));
}
The text was updated successfully, but these errors were encountered:
The application is actually a DirectShow Source Filter DLL which uses DX11 (with no reference to a usable WndProc) rather than a standalone app. The global hook is needed so that hotkeys can be detected regardless of program focus.
The hook succeeds and messages get sent correctly when keys are pressed, but does it somehow get processed differently in ProcessMessage than a normal messaging thread?
The text was updated successfully, but these errors were encountered: