Solved

Joystick in VB5

Posted on 1998-09-14
1
277 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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…
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…
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…
Suggested Courses
Course of the Month3 days, 21 hours left to enroll

630 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