command line call to joyGetPosEx function

How would this code look like in C++?
It's currently written in autohotkey, but I would like write it in C++ since C++ is much faster to execute a simple program like the one below. Also I'm trying to keep filesize small.

1
2
3
4
port = %1%
VarSetCapacity(joy_State, 512)
joy_Error := DllCall("winmm\joyGetPosEx", "ptr", port, "ptr", &joy_State)
Exit, %joy_Error%


port = first command line parameter
joyGetPosEx function for winmm.dll (Windows only)
joy_Error is the value returned by the joyGetPosEx function
Exit, %joy_Error% sets the exit code for the program to be the same as joy_Error

Last edited on
How would this code look like in C++?

It wouldn't. C++ doesn't encompass the concept of joysticks.

On the other hand, you could find some C++ library that deals with joystick input and ask what using the library would look like in a forum where that library is on topic (although you should, preferably, try to glean that information from the documentation for that library first.) Or, you might check to see if your O/S has something similar in it's API that you can access via C++.
Topic archived. No new replies allowed.