Solved

Joystick in VB5

Posted on 1998-09-14
1
261 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now