Does anyone know ho to read Joystick positions, buttons etc from within
Delphi?
Thanks,
DG
________________________________________________
Dennis Gibson
Electronics Unit
Research School of Physical Sciences & Engineering
Australian National University , ACT 0200
Australia
Phone / Fax: (06) 249 4433 [ International: +61 6 249 4433]
Email: dennis...@anu.edu.au
________________________________________________
Writing to hardware will get you into trouble ... open the MMSYSTEM.HLP file
and look up Joystick functions (joyGetNumDevs, joyGetPos, etc).
---------------------------------------------------------------------
Steven E. Hugg
http://pobox.com/~hugg/
Sorry I can't help anymore. I've not tried it, yet...
As comprehensive as many of the windows programming references are, all
that C++ gives me a headache (plus you have to spend the extra $$$ for
a CD which you can't use cos it's all in MS C++). Is anyone aware of
any good books concentrating solely on using windows (95) API's in the
Delphi (2.0) environment? As time goes by I seem to want to use API's
directly more and more, and it's not always clear (to me) how the API's
are implemented by reading the unit pas files.
--
Neil Yeoman
ne...@neily.demon.co.uk
DG>Does anyone know ho to read Joystick positions, buttons etc from within
DG>Delphi?
In Windows 3.1 and with Delphi 1 you could use the Joystick functions
found in the MMSystem unit. To get help, open your Delphi help file.
From the WinHelp File menu choose Open, and select the file
"mmsystem.hlp" in your \delphi\bin directory. Click Function Overview
on the Contents page and click again on Joystick services. There are
many interesting functions.
Regards,
Jani
--
---------------------------------------------------------------------
Jani Jarvinen, Helsinki Finland jani.j...@hiway.fipnet.fi
Check out Help Editor 2.0 for Windows at:
ftp://ftp.mpoli.fi/metropoli/windows/utils/hlped20.zip
1996: Only four years to computer confusion!
What have you done to avoid it?
---------------------------------------------------------------------
---
* SLMR 2.1a *
>Gidday,
>
>Does anyone know ho to read Joystick positions, buttons etc from within
>Delphi?
>
>Thanks,
>
>DG
>________________________________________________
>
>Dennis Gibson
>Electronics Unit
>Research School of Physical Sciences & Engineering
>Australian National University , ACT 0200
>Australia
>Phone / Fax: (06) 249 4433 [ International: +61 6 249 4433]
>Email: dennis...@anu.edu.au
>________________________________________________
Uses ..., mmsystem;
...
var
joyinfo:tjoyinfo;
rvalue:mmresult;
begin
rvalue:=joygetpos(JOYSTICKID1,@joyinfo);
if rvalue = joyerr_noerror then begin
label4.caption:=inttostr(joyinfo.wxpos);
label5.caption:=inttostr(joyinfo.wypos);
label6.caption:=inttostr(joyinfo.wzpos);
with joyinfo do begin
if (wbuttons and joy_button1)=joy_button1 then
radiobutton1.checked:=true else
radiobutton1.checked:=false;
if (wbuttons and joy_button2)=joy_button2 then
radiobutton2.checked:=true else
radiobutton2.checked:=false;
if (wbuttons and joy_button3)=joy_button3 then
radiobutton3.checked:=true else
radiobutton3.checked:=false;
if (wbuttons and joy_button4)=joy_button4 then
radiobutton4.checked:=true else
radiobutton4.checked:=false;
end;
look at the source for mmsystem.pas...
Has anyone had any luck doing a JoyGetPosEx(JOYSTICKID1,@joyex); where
joyex is of the type tjoyinfoex? All I get is an error : 11 -
mmsyserr_invalparam. The joygetpos works fine...?
Chris
~~~~~~~~~~~~~~~~~~~
csul...@eclipse.net Chris Sullens
* 100,000 Lemmings can't be wrong *
~~~~~~~~~~~~~~~~~~~
>Has anyone had any luck doing a JoyGetPosEx(JOYSTICKID1,@joyex); where
>joyex is of the type tjoyinfoex? All I get is an error : 11 -
>mmsyserr_invalparam. The joygetpos works fine...?
You have to set bits in dwflags to say what you want returned.
$000000FF should return all axis and buttons.
Cheers Terry...