|IMG Developer's Kit: Developer's Kit Guide and Technical Documentation; Version 1.79; User's Guide|
|Prev||Chapter 11. Joystick To Mouse Utilities||Next|
TYPE: Utility / Stand-alone Executable with Source
LANGUAGE: C++ / Windows API
IDE: Microsoft Visual C++ 6
Joystick-To-Mouse External speed control + Other Utilities
Joystick-To-Mouse now has predefined messages for controlling the internal speed variables and global acceleration setting, along with basic operation and buttons. This allows high-level development environments some basic control over the functionality of Joystick-To-Mouse.
Various other utilities have been added. These are primarily meant for true developer's, although there are a set of pre-built EXEs that can be used by a computer user that is familiar with the basic concepts of programs, messaging, and scripting.
The following "external" interfaces are available via these utilities:
Set Speed (1-10, 0, and Reset from current configuration)
On, Off, Close (Start, Stop, or Close Joystick-To-Mouse)
Buttons (1-32, 01-10 built as EXEs)
This is bare-bones code that implements the control of Joystick-To-Mouse.
There are pre-built EXEs that can be implemented via a WinExec, CreateProcess, Shell, Spawn, etc. function
Details about the source code are in the source code. This is developer material, and the source code is the explanation / details you need (if you are a developer).
These are the available EXEs with descriptions:
JTMSPD00.EXE - Set speed of 0, center mouse cursor
JTMSPD01.EXE - Set speed of 1, disable acceleration
JTMSPD02.EXE - Set speed of 2, disable acceleration
JTMSPD03.EXE - Set speed of 3, disable acceleration
JTMSPD04.EXE - Set speed of 4, disable acceleration
JTMSPD05.EXE - Set speed of 5, disable acceleration
JTMSPD06.EXE - Set speed of 6, disable acceleration
JTMSPD07.EXE - Set speed of 7, disable acceleration
JTMSPD08.EXE - Set speed of 8, disable acceleration
JTMSPD09.EXE - Set speed of 9, disable acceleration
JTMSPD10.EXE - Set speed of 10, disable acceleration
JTMRESET.EXE - reset from the last set of saved settings for speed and acceleration
JTMON.EXE - turn ON Joystick-To-Mouse if OFF
JTMOFF.EXE - turn OFF Joystick-To-Mouse if ON
JTMCLOSE.EXE - Close Joystick-To-Mouse
JTMBTN01.EXE - trigger button 1 if pressed (Macros not supported)
JTMBTN02.EXE - trigger button 2 if pressed (Macros not supported)
JTMBTN03.EXE - trigger button 3 if pressed (Macros not supported)
JTMBTN04.EXE - trigger button 4 if pressed (Macros not supported)
JTMBTN05.EXE - trigger button 5 if pressed (Macros not supported)
JTMBTN06.EXE - trigger button 6 if pressed (Macros not supported)
JTMBTN07.EXE - trigger button 7 if pressed (Macros not supported)
JTMBTN08.EXE - trigger button 8 if pressed (Macros not supported)
JTMBTN09.EXE - trigger button 9 if pressed (Macros not supported)
JTMBTN10.EXE - trigger button 10 if pressed (Macros not supported)
Interfacing with Joystick-To-Mouse from an application.
Decide which method:
INTERNAL (using Windows API Messaging), or
EXTERNAL (run pre-built stand-alone executables via Shell or WinExec type commands).
To use the INTERNAL method, your development environment must support calls such as FindWindow and SendMessage.
To use the EXTERNAL method, you must have the ability to compile C based Windows Source code with a Windows Application as the target.
If the requirements are not clear, then this type of low-level program interfacing is not recommended.
Otherwise reference the JTMSPEED.C and JTMSPEED.RC files for reference & proceed on to STEP 2.
STEP 2 - INTERNAL (Overview)
Obtain the Window handle for the Joystick-To-Mouse window. As seen in the source code, only the Class of "Joystick-To-Mouse" is required for the FindWindow API call. Note that the Window Text (Window Name / Caption Bar Text) can change from "Joystick-To-Mouse" to "Joystick-To-Mouse ON" to "Joystick-To-Mouse OFF" - this can be dangerous to use because of these changes, however, it can also allow your application to sense the current state of Joystick-To-Mouse.
Once you have the window handle, you must then Send or Post a message to JTM. The SendMessage API is preferred because the action will be engaged immediately. All of the options return a TRUE (non-0) value.
Reference JTMSPEED.C for an example and also see the header info below.
If required to use decimal values, note the appropriate values under the HEADER DEFINES.
Also note that working between 16 & 32-bit apps may cause parameter issues.
For reference, the parameters expected within the JTM window function are:
HWND - Handle to JTM - Must be obtained within your app by some mechanism.
MESSAGE - Must be WM_COMMAND, or 273 decimal
WPARAM - Must be the appropriate value (see HEADER DEFINES) (256-267 decimal)
LPARAM - Not used - should be 0 to resolve 16/32 bit issues.
STEP 2 - EXTERNAL (Overview)
Most of the basic EXEs have been compiled for you, only the Buttons 10-32 have not. See Overview for details about each executable. Once these files are built, use the Shell or WinExec to launch the executable when triggered by the appropriate event.
STEP 3 - EXTERNAL APP CONSIDERATIONS
If using the MouseMove event to trigger the communication between your app and JTM, it is recommended to use a global boolean variable to indicate the status of the communication. If this is not implemented, you will end up sending numerous messages to JTM, and this can be especially undesirable if using the external method of communication.
In testing, the following method was used to make a clean interface:
2 Controls were created, a button, with a larger enclosing rectangle (static box) surrounding the button.
Both Controls were configured to have the MouseMove property event trigger communication with JTM, with a Global variable used to indicated which state JTM was in (Fast or Slow). If "Fast", the button would send the "Slow" speed to JTM & set the variable to "Slow". If "Slow", the rectangle would send the RESETSPEED ("Fast" in this example), and change the variable to "Fast".
The RESETSPEED command results in JTM re-reading the INI file for the values set there. If you have the capability of modifying the INI, you can use the SpeedX, SpeedY, and Multiply settings, and then issue the RESETSPEED message.
Multiply is the internal variable for Global acceleration effects. Using any of the SETSPEED? commands results in the Multiply variable to be set to 0, disabling acceleration. If you do not have acceleration enabled, then this means nothing, but if you do, you MUST call RESETSPEED to return JTM to its proper settings.
All SETSPEED? messages set X & Y speeds to the same values, and clears the global acceleration variable.
RESETSPEED message re-reads the values from the INI.
Final note: If you are working within JTM to configure settings, and working with an external app that can affect the internal variable settings, you may get strange results when the INI file is saved/re-read. It is strongly recommended that you stay out of the JTM setting dialogs while using these external messages.
Developers Kit Version 1.78 Release 3 - 9/26/2007
Copyright 1995-2007 by Innovation Management Group, Inc.
All Rights Reserved.