Article View: borland.public.cppbuilder.nativeapi
Article #9572Re: bool IsJoystickAttached(unsigned int JSNo);
From: Edward
Date: Mon, 05 Jul 2004 02:16
Date: Mon, 05 Jul 2004 02:16
83 lines
2913 bytes
2913 bytes
MMRESULT jr;
int jnum;
JOYINFOEX JoyInfo;
JOYCAPS JoyCaps;
bool connect;
MemoLOG->Lines->Add(AnsiString("Nro JoyStick Suportados pelo Driver: ")+
AnsiString(joyGetNumDevs()));
if(joyGetNumDevs()!=0)
{
connect=false;
jr = joyGetPosEx(JOYSTICKID1,&JoyInfo);
if (jr ==JOYERR_NOERROR)
{
connect=true;
jnum=JOYSTICKID1;
}
else
{
if (jr == MMSYSERR_INVALPARAM)
ShowMessage("MMSYSERR_INVALPARAM");
else
if((jr=joyGetPosEx(JOYSTICKID2,&JoyInfo)) == JOYERR_NOERROR)
{
connect = true;
jnum= JOYSTICKID2;
}
}
}
jr = joyGetDevCaps(jnum,&JoyCaps, sizeof(JOYCAPS));
if (connect)
{
MemoLOG->Lines->Add("JOYSTICK CONNECTED.") ;
MemoLOG->Lines->Add("JOYSTICK ID: "+ IntToStr(jnum));
MemoLOG->Lines->Add("Product Name: " + AnsiString(JoyCaps.szPname));
MemoLOG->Lines->Add("Nro Nuttons: " + IntToStr(JoyCaps.wNumButtons));
}
else
{
MemoLOG->Lines->Add("JOYSTICK NOT CONNECTED.");
}
<JS Trop> escreveu na mensagem news:40e3fe01$1@newsgroups.borland.com...
>
//==========================================================================
> ====
> /*!
> * \fn bool IsJoystickAttached(unsigned int JSNo);
>
> * \brief This function returns true if the specified joystick is
available
> ie. attached to the computer.
>
> * \param unsigned int JSNo : (input) Joystick number
>
> * \sa ...
> Example :
> int MyJoystickNo = 2;
> if (AFDAS::GetIPAdr(NULL,&IPAdr)){
> Memo1->Lines->Add(AnsiString(inet_ntoa(IPAdr)));
> }
> */
>
>
//==========================================================================
> ====
>
>
> bool IsJoystickAttached(unsigned int JSNo)
> {
>
> if (Joystick JSNo is attached) //// How to test if Joystick JSNo is
> attached
> return true;
> else
> return false;
> }
>
>
>
>
>
>
Technical Details
Message-ID:
<40e8b9ef$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<40e3fe01$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,d329d830f6d9144f X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Edward" <Registrados2004@aol.com> From: "Edward" <Registrados2004@aol.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <40e3fe01$1@newsgroups.borland.com> Subject: Re: bool IsJoystickAttached(unsigned int JSNo); Date: Sun, 4 Jul 2004 23:16:15 -0300 Lines: 85 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 200.213.49.155 Message-ID: <40e8b9ef$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1088993775 200.213.49.155 (4 Jul 2004 19:16:15 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail