Click here to Skip to main content
16,015,559 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Good day! I have a challenging task related to vJoy I suppose: is it real to create a virtual device and then emulate signals (joystick API)? I mean I have no real physical device but I have to send signals programmatically (like there is a joystick or xbox gamepad switched on for instance). Any help is higly appreciated

What I have tried:

I have tried to investigate vJoy SDK but I have been lost there)
Posted
Updated 7-Jun-17 1:27am
Comments
Foothill 20-Jul-16 17:27pm    
About the only way I can think of to emulate input in C++ would be to use the Windows Message Pump
https://msdn.microsoft.com/en-us/library/windows/desktop/ms644927(v=vs.85).aspx
with SendMessage
https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950(v=vs.85).aspx
in a separate application. The real challenge is to figure out what inputs to send.

*edit: windows messages are very low level programming and not the easiest thing to use.

If you already know or have access to the full specification of your joystick's protocol you can skip steps 1 & 2.

1. Find a way to connect your joystick or controller to one a serial port correctly, get a PCI card if you have to.
2. Run a listener program connected to the (newly installed?) PCI card's serial port and get the joy stick's output to use for your emulator.
3. Write a serial device driver or use one of the several emulators available (free & $). Search for faking-an-rs232-serial-port on stack overflow.
Here is a recommended free one:
com0com - With Signed Driver (old version)
and a non-free one
COM PORT DATA EMULATOR
4. Write a joystick data pump program to connect to one end of your serial line and the other connected to your actual test program.
5. Test...
 
Share this answer
 
v2
At the end of the day Windows and applications on Windows are running around the message queue. Looping over it and processing the messages there...
So all you need to do is sending joystick related messages to you application (the one uses joystick) from your application (the joystick emulator)...
Joystick Notification Messages (Windows)[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900