directinput

Should I use DirectInput or Windows message loop?

大城市里の小女人 提交于 2019-12-17 18:33:09
问题 I'm working on a C++ DirectX 2D game and I need keyboard and mouse input. Wikipedia says: Microsoft recommends that new applications make use of the Windows message loop for keyboard and mouse input instead of DirectInput So how should I use it? I have a GameScreen class whice take care of the drawing and the updating(game logic), I call the Draw and the Update methods inside a windows message loop. Thanks 回答1: Since you pretty much have to run a message pump in order to have a window, you

USB Joystick with C++ and DirectInput

别来无恙 提交于 2019-12-13 12:33:10
问题 I've been trying to read data (x/y axis, pressed buttons, etc) from a usb joystick, and I've heard of DirectInput. Been searching for some long hours to find a decent example or walkthrough with little success. If anyone can share a simple tutorial, or guide me to the correct place, I'll be in your debt. Thank you edit: Trying to achieve this goal on Windows platform 回答1: There are a few DirectInput samples in DirectX SDK, source code and compiled binaries. Included is Joystick sample. Older

Error Message when Referencing .dll Files

試著忘記壹切 提交于 2019-12-11 18:56:54
问题 I would like the use DirectInput in my XNA game however I'm having an issue when it comes to referencing the .dll file. I'm using Microsoft Visual Studio C# Express Edition. This is exactly what I do: right click "References" chose "add reference" navigate to the .dll file and hit OK I then receive the following error: As stated above I would like to reference the Microsoft.DirectX.DirectInput namespace but I don't know which .dll file that it's in so I just picked the "d3dref9.dll". Every

how to determine keyboard disconnected in DirectInput

冷暖自知 提交于 2019-12-11 13:15:58
问题 I am monitoring HID connections using EnumDevices(..., DIEDFL_ATTACHEDONLY). When I disconnect a game controller it no longer shows up in the callback. However, when I disconnect the keyboard, it still shows up in EnumDevices. I've looked through the API, but I don't see where else to query if a device is connected. 回答1: What about http://msdn.microsoft.com/en-us/library/windows/desktop/aa363432%28v=vs.85%29.aspx You can subscribe to any device notifications like attach,detach,etc... 来源:

2 Mice, capturing exclusively one mouse on windows (DirectInput, DDK, Linux, anything)

醉酒当歌 提交于 2019-12-11 09:08:43
问题 I have connected 2 mice to PC and I wish one mouse to work as regular mouse and capture second mouse exclusively. First I was trying DirectInput. It showed 2 devices with word mouse in InstanceName. But only one device had DeviceType.Mouse and it was only really working device. When I was acquiring it was blocking both mice. Second I decided to create driver. I downloaded WinDDK. There is Mouse Filter driver sample. I was able to compile it. But I am not driver programmer. It is complex for

Ctrl+Alt+Del and DirectInput

人走茶凉 提交于 2019-12-08 03:56:37
问题 I am using DirectInput in C++ to acquire the mouse and keyboard for my program. This works fine and I re-acquire if I get the InputLost error. However, when I press Ctrl + Alt + Del my program gets E_ACCESSDENIED when attempting to acquire, even when the program window is re-selected. This occurs even if I don't actually select an option within the Ctrl + Alt + Del window (just press cancel). I am curious as to how a program is meant to recover input after this has happened. I am currently

USB Joystick with C++ and DirectInput

元气小坏坏 提交于 2019-12-06 06:37:39
I've been trying to read data (x/y axis, pressed buttons, etc) from a usb joystick, and I've heard of DirectInput. Been searching for some long hours to find a decent example or walkthrough with little success. If anyone can share a simple tutorial, or guide me to the correct place, I'll be in your debt. Thank you edit: Trying to achieve this goal on Windows platform There are a few DirectInput samples in DirectX SDK, source code and compiled binaries. Included is Joystick sample. Older versions of SDK (look for "DirectX 9.0 SDK", years around 2004-2005) had even more samples, up to a dozen!

c++ win32 Simulate Keypress with DirectInput

帅比萌擦擦* 提交于 2019-12-06 05:46:51
问题 How can I simulate a keypress with DirectInput? I currently have the initialization (but I'm not sure is it good or not): #include <dinput.h> #pragma comment (lib, "dinput8.lib") #pragma comment (lib, "dxguid.lib") LPDIRECTINPUT8 din; // the pointer to our DirectInput interface LPDIRECTINPUTDEVICE8 dinkeyboard; // the pointer to the keyboard device BYTE keystate[256]; // the storage for the key-information void initDInput(HINSTANCE hInstance, HWND hWnd); // sets up and initializes DirectInput

How to keep pynput and ctypes from clashing?

荒凉一梦 提交于 2019-12-04 22:36:43
I'm using this gem from somewhere on this site. import ctypes import pynput SendInput = ctypes.windll.user32.SendInput W = 0x11 A = 0x1E S = 0x1F D = 0x20 # C struct redefinitions PUL = ctypes.POINTER(ctypes.c_ulong) class KeyBdInput(ctypes.Structure): _fields_ = [("wVk", ctypes.c_ushort), ("wScan", ctypes.c_ushort), ("dwFlags", ctypes.c_ulong), ("time", ctypes.c_ulong), ("dwExtraInfo", PUL)] class HardwareInput(ctypes.Structure): _fields_ = [("uMsg", ctypes.c_ulong), ("wParamL", ctypes.c_short), ("wParamH", ctypes.c_ushort)] class MouseInput(ctypes.Structure): _fields_ = [("dx", ctypes.c_long

c++ win32 Simulate Keypress with DirectInput

陌路散爱 提交于 2019-12-04 11:27:39
How can I simulate a keypress with DirectInput? I currently have the initialization (but I'm not sure is it good or not): #include <dinput.h> #pragma comment (lib, "dinput8.lib") #pragma comment (lib, "dxguid.lib") LPDIRECTINPUT8 din; // the pointer to our DirectInput interface LPDIRECTINPUTDEVICE8 dinkeyboard; // the pointer to the keyboard device BYTE keystate[256]; // the storage for the key-information void initDInput(HINSTANCE hInstance, HWND hWnd); // sets up and initializes DirectInput void detect_input(void); // gets the current input state void cleanDInput(void); // closes DirectInput