Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Joystick in VB5

Posted on 1998-09-14
1
Medium Priority
?
288 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 600 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

971 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