示例#1
0
	RawInputPad(int port) : Pad(port)
	, doPassthrough(false)
	, usbHandle(INVALID_HANDLE_VALUE)
	{
		if (!InitHid())
			throw PadError("InitHid() failed!");
	}
示例#2
0
int InitWindow(HWND hWnd)
{
#if 1
	if (!InitHid())
		return 0;

	RegisterRaw(hWnd, 0);
	hHook = SetWindowsHookEx(WH_GETMESSAGE, HookProc, hInst, 0);
	//hHookKB = SetWindowsHookEx(WH_KEYBOARD_LL, KBHookProc, hInst, 0);
	int err = GetLastError();
#else
	eatenWnd = hWnd;
	eatenWndProc = (WNDPROC) SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)RawInputProc);
	RegisterRaw(hWnd, 0);
#endif
	return 1;
}
示例#3
0
int Initialize(void *ptr)
{
	HWND hWnd = reinterpret_cast<HWND> (ptr);
	if (!InitHid())
		return 0;

#if 0
	if (!RegisterRaw(hWnd))
		return 0;
	hHook = SetWindowsHookEx(WH_GETMESSAGE, HookProc, hInst, 0);
	//hHookWnd = SetWindowsHookEx(WH_CALLWNDPROC, HookWndProc, hInst, 0);
	//hHookKB = SetWindowsHookEx(WH_KEYBOARD_LL, KBHookProc, hInst, 0);
	int err = GetLastError();
#else
	eatenWnd = hWnd;
	eatenWndProc = (WNDPROC) SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)RawInputProc);
	RegisterRaw(hWnd);
#endif
	return 1;
}