Default
Google

How can I get detailed information?

Applies To: C++Builder 1 or higher
Category: Knowledge Base

 
 1.
  Start a new project using File | New Application.
 
 2.
  Add a ListView. Insert 2 columns: Property and Value.
 
 3.
  Insert in your code:
 
void TForm1::Add(String property, String value)
{
    TListItem *item = ListView1->Items->Add();
    item->Caption = property;
    item->SubItems->Add(value);
}
 
This function will help us add information to the ListView more easily.
 
 4.
  Edit your header file:
 
private:
    void Add(String property, String value);
 
 5.
  Add a Button. Double-click its OnClick event:
 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    JOYCAPS caps;
    JOYINFO info;
 
    // Get information about the first joystick
    // Change this value if using multiple joysticks
    const int number = 0;
 
    MMRESULT error = joyGetPos(number, &info);
    if(error != JOYERR_NOERROR)
    {
        ShowMessage("The joystick #" + IntToStr(number)
            + " was not found.");
        return;
    }
 
    joyGetDevCaps(number, &caps, sizeof(JOYCAPS));
 
    Add("Manufacturer identifier", (String)caps.wMid);
    Add("Product identifier", (String)caps.wPid);
    Add("Product name", (String)caps.szPname);
    Add("Driver OEM", (String)caps.szOEMVxD);
    Add("Registry key", (String)caps.szRegKey);
    Add("Number of buttons", (String)caps.wNumButtons);
    Add("", "");
    Add("Minimum X", (String)caps.wXmin);
    Add("Maximum X", (String)caps.wXmax);
    Add("Minimum Y", (String)caps.wYmin);
    Add("Maximum Y", (String)caps.wYmax);
    Add("Minimum Z", (String)caps.wZmin);
    Add("Maximum Z", (String)caps.wZmax);
}
 
 6.
  Insert #include <mmsystem.h>.
 
The joyGetDevCaps multimedia function allows you to get specific information about a joystick.

C++Builder Developer's Network
Copyright © Yoto Yotov



Acquiring image from ProHosting Banner Exchange