Hello,
I'm having slight difficulties to aquire the keypress for the screenshot-key in my Win32 application. It appears there is no WM_KEYDOWN being generated/caught/processed on my applications end (though WM_KEYUP is received on release of the button). Every other button on my keyboard seemed to work though (A-Z, 0-9, ctrl, alt, delete, scroll, pause, end, insert, ...). I'm simply catching those events in a callback function like that:
LRESULT CALLBACK WindowHandler(HWND hwnd, unsigned int msg, WPARAM wParam, LPARAM lParam)
{
// test for message
switch(msg)
{
// ...
case WM_KEYDOWN:
{
const bool bPreviouslyDown = ((lParam & (1 << 30)) != 0);
input::WindowProcHook::SetRawButtonState(input::winToKey(wParam), true, bPreviouslyDown);
gui::WindowProcHook::OnShortcut(wParam);
break;
}
case WM_KEYUP:
input::WindowProcHook::SetRawButtonState(input::winToKey(wParam), false, true);
break;
// ...
}
}
I'm looking for occurances of VK_SNAPSHOT as the key, which is generated for WM_KEYUP when I release the screenshot key, so that one should be right. As for WM_KEYDOWN, none is created when pressing the key, so there should be no issues here. This is how I register the window class:
const WNDCLASSEX wndClass =
{
sizeof(WNDCLASSEX), // size
#ifdef ACL_API_GL4
CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_OWNDC,
#else
CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, // styles
#endif
WindowHandler, // callback-function
0, // additional infos
0, // not needed
m_hInstance,
LoadIcon(nullptr, IDI_WINLOGO), // windows logo
nullptr, // normal cursor
(HBRUSH)GetStockObject(WHITE_BRUSH), // white brush
nullptr, // no menue
lpClassString, // class name
LoadIcon(nullptr, IDI_WINLOGO) // windows logo
};
RegisterClassEx(wndClass);
and create the window:
m_hWnd = CreateWindowEx(0,
lpClassString,
lpTitle,
WS_VISIBLE | WS_EX_TOPMOST | WS_POPUP,
m_x, m_y,
m_width, m_height,
nullptr,
nullptr,
m_hInstance,
nullptr);
const MARGINS marg = { m_x, m_width, m_y, m_height };
DwmExtendFrameIntoClientArea(m_hWnd, &marg);
Do you see anything suspisious here, or is there some other reason you know of that this/any certain key cannot be captured?