When my windows application (a game) starts, I register it to receive raw input messages:
RAWINPUTDEVICE Rid[2];
Rid[0].usUsagePage = HID_USAGE_PAGE_GENERIC; // 0x01
Rid[0].usUsage = HID_USAGE_GENERIC_MOUSE; // 0x02
Rid[0].dwFlags = RIDEV_INPUTSINK;
Rid[0].hwndTarget = sMainWindow; // HWND from created window
Rid[1].usUsagePage = HID_USAGE_PAGE_GENERIC; // 0x01
Rid[1].usUsage = HID_USAGE_GENERIC_KEYBOARD; // 0x06
Rid[1].dwFlags = RIDEV_INPUTSINK;
Rid[1].hwndTarget = sMainWindow;
BOOL result = RegisterRawInputDevices( Rid, 2, sizeof( Rid[0] ) );
if( !result )
{
EGSystemError( "RegisterRawInputDevices Error: ", GetLastError() );
}
This game has been released and many users seem to have no trouble with it, but I have one user who is getting the error message:
"RegisterRawInputDevices Error: The system cannot find the file specified"
So, the question is- why would RegisterRawInputDevices() ever generate a ERROR_FILE_NOT_FOUND error? I haven't seen any references in the docs that help. Does anyone have experience with this?
Above comment is not correct or spec is not correct
MSDN is reporting https://msdn.microsoft.com/it-it/library/windows/desktop/ms645600(v=vs.85).aspx
cbSize [in] Type: UINT The size, in bytes, of a RAWINPUTDEVICE structure.
The reason why this isn't working is because you are passing only one RAWINPUTDEVICE
structure for the sizeof
. It should be like this..
sizeof( Rid )
not
sizeof( Rid[0] )
Hope this helps for others since I had a bit of trouble with it also!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.