Solved

Joystick in VB5

Posted on 1998-09-14
1
268 Views
Last Modified: 2010-05-18
How do you set it up so that something happens when you click a joystick button?  Lets say for example that you want a msg box to show up when button #1 is clicked.  Please help!  Thanks...

  The Gringo
0
Comment
Question by:GringoHombre
1 Comment
 
LVL 1

Accepted Solution

by:
Jason_G earned 150 total points
ID: 1434858
Hi Gringo,
There is a sample program available from Microsoft, it's called Joystick.exe and it is a self-extracting compressed file containing a sample project that demonstrates how to use the Joystick API functions in Visual Basic. You can use this sample as a starting point for a game program that uses a joystick for an input device.

You can find this file here;
http://support.microsoft.com/download/support/mslfiles/joystick.exe

When you run the self-extracting compressed file, the following files are expanded in the Joystick Sample Project directory:
Form1.frm (7Kb) - the main form of the project.
Joystick.vbp (1Kb) - the project file.
Joystick.vbw (1Kb) - the workspace file.
Module1.bas (7Kb) - the module containing the function, user-defined type and constants declarations.
Readme.txt (2Kb) - you are currently reading this file.

How the Sample Works
The joyGetDevCaps function is used in the form load event to determine if a joystick is connected to the system. If the function is successful, the form is redrawn with new controls to display the capabilities of the joystick. These capabilities are stored in the members of the JOYCAPS user- defined type variable. A timer control is used to poll the joystick's position. The current position is determined by the successful results of the joyGetPosEx function. The members of the JOYINFOEX user-defined variable type contain the joystick position information. This information is displayed in text boxes in the form.

I hope this helps!

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, http://scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question