directinput

DirectInput8 EnumDevices sometimes painfully slow

核能气质少年 提交于 2020-05-29 03:59:47
问题 Sometimes (in about 50% of runs), EnumDevices takes 5-10 seconds to return. Normally it is almost instant. I couldn't find any other reports of this kind of behaviour. When things are this slow, it's ok to profile by watching stdout :) This: std::cout << "A"; directInput8Interface->EnumDevices(DI8DEVCLASS_GAMECTRL, MyCallback, NULL, DIEDFL_ATTACHEDONLY); std::cout << "C"; ... BOOL CALLBACK MyCallback(LPCDIDEVICEINSTANCE, LPVOID) { std::cout << "B"; return DIENUM_CONTINUE; } Seems to hang at a

Catching “global hotkeys” (Windows)

南楼画角 提交于 2020-01-06 05:38:08
问题 Now I've been trying to create a similar functionality as there is in Push-To-Talk voice chat applications, but so far I couldn't find any fitting solutions to this. I am not using MFC or CLR. The problem is quite simple. My window should be usually out of focus (ie minimized etc), but I need to react to keypresses (basically, I don't even want to know if the button is being held down or not). Unfortunately, WM_KEYDOWN only works if the window has keyboard focus. I do know that for example

Catching “global hotkeys” (Windows)

百般思念 提交于 2020-01-06 05:38:06
问题 Now I've been trying to create a similar functionality as there is in Push-To-Talk voice chat applications, but so far I couldn't find any fitting solutions to this. I am not using MFC or CLR. The problem is quite simple. My window should be usually out of focus (ie minimized etc), but I need to react to keypresses (basically, I don't even want to know if the button is being held down or not). Unfortunately, WM_KEYDOWN only works if the window has keyboard focus. I do know that for example

C++ DirectInput Mouse Scroll Wheel with a Laptop Touchpad

左心房为你撑大大i 提交于 2020-01-05 05:25:49
问题 When using DirectInput, it is my understanding that the mouse wheel delta should be stored in DIMOUSESTATE objects lZ variable. However, when I am scrolling with my laptop touchpad instead of an actual mouse with a wheel, it seems like the scroll is not being recognized since 1Z remains zero always. Is there a better solution than using WM_MOUSEWHEEL if that will even work? Since I am currently using DirectInput for the rest of the input I would like to stay consistent and use that but how

Low level mouse hook and DirectX

…衆ロ難τιáo~ 提交于 2019-12-30 04:24:25
问题 I'm building an application which needs to filter some mouse clicks system-wide. That is, I need to make the system ignore some mouse button clicks at special occasions. I use low level mouse hook and SetWindowsHookEx to filter out these clicks. It works relatively well, except for WPF applications. I guess that's because these applications use DirectX and DirectInput for input processing, and that's why I can't filter out clicks in these applications, since they get the input directly from

Using Joystick in Windows Forms application

﹥>﹥吖頭↗ 提交于 2019-12-25 04:47:14
问题 I've got a problem with my application. I wrote a code that works fine in console, but I need to make a GUI. This application let me control a mouse with joystick. I'm using Direcinput library. It is reading position of joystick and its name. Here is my code: #ifndef D_INPUT #define D_INPUT #include <dinput.h> #include <iostream> #endif LPDIRECTINPUT8 di; HRESULT hr; LPDIRECTINPUTDEVICE8 joystick; DIDEVICEINSTANCE pdidi; DIDEVICEINSTANCE info; BOOL CALLBACK enumCallback(const DIDEVICEINSTANCE

Simulate keystrokes in inactive windows

六月ゝ 毕业季﹏ 提交于 2019-12-25 01:35:46
问题 I'd like to simulate 'real' keystrokes in an inactive window. After some research I found the Windows api. Since Im used to Java, I quickly found JNA, which implements the winapi. I wrote some code, that could simulate keystrokes in a active window with the sendInput() method. The window did not detect virtual keycodes. After some search, windows with directinput need scancodes apparently. And it worked with the following code: import com.sun.jna.platform.win32.BaseTSD; import com.sun.jna

Problems sending keystroke to DirectX application using SendInput wrapper

末鹿安然 提交于 2019-12-24 11:53:56
问题 I've been trying to send key presses to a DirectX application for a little while now, and keep striking out. I'm new to C#, so some of the more complicated functions go right over my head, but I've been trying to piece it together best I can. SendInput is one of those things that I just can't seem to grasp. I've tried using a few different SendInput wrappers to simplify things for me, including: http://inputsimulator.codeplex.com/ http://www.codeproject.com/Articles/117657/InputManager

DirectX Game hook

孤者浪人 提交于 2019-12-21 04:48:58
问题 I'm trying to simulate mouse events in a game. The games uses DirectInput so you can't use SendMessage to send mouse events/keyboard events to it, that's basically why I have to hook in to the game. Also I don't want to use SendInput/mouse_events, the game must run on the background and make mouse events. I already managed to make a DLL hook in the game but now the next problem is that I have to make the mouse events and keyboards (probably the main problem). Thanks in advance. 回答1: Instead