<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Joystick Position abfragen]]></title><description><![CDATA[<p>Hallo,<br />
ich habe im Internet ein fertiges Programm in VisualBasic gefunden um die Position der Joystick-Achsen abzufragen.<br />
Hier der Link zum Code des fertigen Programms:<br />
<a href="http://www.activevb.de/tipps/vb6tipps/tipp0459.html" rel="nofollow">http://www.activevb.de/tipps/vb6tipps/tipp0459.html</a><br />
Ich brauch für ein Schulprojekt ein C Programm das mir die Position des Joysticks abfragt. Leider hab ich noch nicht so viel Erfahrung in Programmieren um dieses fertige Programm von VisualBasic in C umzuwandeln.<br />
Ich habe mal versucht es umzuwandeln, klappt aber noch nich ganz, vll. kann mir jemand sagen was ich falsch gemacht habe..</p>
<p>Hier mein Programm:</p>
<pre><code>#include &quot;stdafx.h&quot;
#include &lt;iostream.h&gt;

#include &lt;windows.h&gt;
#include &lt;mmSystem.h&gt;

long _stdcall joyGetDevCaps(long id, JOYCAPS lpCaps, long uSize);
long _stdcall joyGetPos(long uJoyID, JOYINFO pji);

struct JOYINFO{
  long X;
  long Y;
  long Z;
  long Buttons;
}

struct JOYCAPS{
  long wXmin;
  long wXmax;
  long wYmin;
  long wYmax;
}

int GetJoyMax(int joy, JOYINFO JI){
  JOYCAPS jc;
  if(joyGetDevCaps(joy, jc) != JOYERR_NOERROR){
   GetJoyMax = 0;
  }
  else{
   JI.X = jc.wXmax;
   JI.Y = jc.wYmax;
   GetJoyMax = 1;
  }
}

int GetJoyMin(int joy, JOYINFO JI){
  JOYCAPS jc;
  if(joyGetDevCaps(joy, jc, strlen(jc)) != JOYERR_NOERROR){
   GetJoyMin = 0;
  }
  else{
   JI.X = jc.wXmin;
   JI.Y = jc.wYmin;
   GetJoyMax = 1;
  }
}

int GetJoystick(int joy, JOYINFO JI){
  if(joyGetPos(joy, JI) != JOYERR_NOERROR){
   GetJoystick = 0;
  }
  else{
   GetJoystick = 1;
  }
}

int main(){
  long JOYERR_NOERR=0;
  long JOYSTICKID1=0;

while(1==1){
   GetJoyMax(JOYSTICKID1, JInfo);
   GetJoyMin(JOYSTICKID1, JInfo);
   GetJoystick(JOYSTICKID1, JInfo);
   printf(&quot;Current X: %d\n&quot;, JInfo.X);
   printf(&quot;Current Y: %d\n&quot;, JInfo.Y);
  }

return 0;
}
</code></pre>
<p>Ich brauch nur die x- und y-Positionen.</p>
<p>Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/166169/joystick-position-abfragen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 01:49:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/166169.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 26 Nov 2006 21:24:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Joystick Position abfragen on Sun, 26 Nov 2006 21:25:21 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich habe im Internet ein fertiges Programm in VisualBasic gefunden um die Position der Joystick-Achsen abzufragen.<br />
Hier der Link zum Code des fertigen Programms:<br />
<a href="http://www.activevb.de/tipps/vb6tipps/tipp0459.html" rel="nofollow">http://www.activevb.de/tipps/vb6tipps/tipp0459.html</a><br />
Ich brauch für ein Schulprojekt ein C Programm das mir die Position des Joysticks abfragt. Leider hab ich noch nicht so viel Erfahrung in Programmieren um dieses fertige Programm von VisualBasic in C umzuwandeln.<br />
Ich habe mal versucht es umzuwandeln, klappt aber noch nich ganz, vll. kann mir jemand sagen was ich falsch gemacht habe..</p>
<p>Hier mein Programm:</p>
<pre><code>#include &quot;stdafx.h&quot;
#include &lt;iostream.h&gt;

#include &lt;windows.h&gt;
#include &lt;mmSystem.h&gt;

long _stdcall joyGetDevCaps(long id, JOYCAPS lpCaps, long uSize);
long _stdcall joyGetPos(long uJoyID, JOYINFO pji);

struct JOYINFO{
  long X;
  long Y;
  long Z;
  long Buttons;
}

struct JOYCAPS{
  long wXmin;
  long wXmax;
  long wYmin;
  long wYmax;
}

int GetJoyMax(int joy, JOYINFO JI){
  JOYCAPS jc;
  if(joyGetDevCaps(joy, jc) != JOYERR_NOERROR){
   GetJoyMax = 0;
  }
  else{
   JI.X = jc.wXmax;
   JI.Y = jc.wYmax;
   GetJoyMax = 1;
  }
}

int GetJoyMin(int joy, JOYINFO JI){
  JOYCAPS jc;
  if(joyGetDevCaps(joy, jc, strlen(jc)) != JOYERR_NOERROR){
   GetJoyMin = 0;
  }
  else{
   JI.X = jc.wXmin;
   JI.Y = jc.wYmin;
   GetJoyMax = 1;
  }
}

int GetJoystick(int joy, JOYINFO JI){
  if(joyGetPos(joy, JI) != JOYERR_NOERROR){
   GetJoystick = 0;
  }
  else{
   GetJoystick = 1;
  }
}

int main(){
  long JOYERR_NOERR=0;
  long JOYSTICKID1=0;

while(1==1){
   GetJoyMax(JOYSTICKID1, JInfo);
   GetJoyMin(JOYSTICKID1, JInfo);
   GetJoystick(JOYSTICKID1, JInfo);
   printf(&quot;Current X: %d\n&quot;, JInfo.X);
   printf(&quot;Current Y: %d\n&quot;, JInfo.Y);
  }

return 0;
}
</code></pre>
<p>Ich brauch nur die x- und y-Positionen.</p>
<p>Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181929</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181929</guid><dc:creator><![CDATA[alex2603]]></dc:creator><pubDate>Sun, 26 Nov 2006 21:25:21 GMT</pubDate></item><item><title><![CDATA[Reply to Joystick Position abfragen on Sun, 26 Nov 2006 21:59:36 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=403" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=4" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181947</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181947</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Sun, 26 Nov 2006 21:59:36 GMT</pubDate></item><item><title><![CDATA[Reply to Joystick Position abfragen on Mon, 27 Nov 2006 00:02:01 GMT]]></title><description><![CDATA[<p>Ein Fehler den ich auf die Schnelle seh: Du verwendest &quot;JOYINFO JI&quot; als Output Parameter, übergibst es aber &quot;by value&quot; - was nicht gehen kann.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181987</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181987</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Mon, 27 Nov 2006 00:02:01 GMT</pubDate></item><item><title><![CDATA[Reply to Joystick Position abfragen on Mon, 27 Nov 2006 16:57:43 GMT]]></title><description><![CDATA[<p>ich hab schon eine lösung gefunden.<br />
falls jemand meine lösung haben will werde ich sie mal posten..</p>
<p>winmm.lib in das projekt einbinden!</p>
<pre><code>#include &quot;stdafx.h&quot;
#include &lt;stdlib.h&gt;
#include &lt;mmSystem.h&gt;

int main(){
  long Xpos;
  long Ypos;

JOYINFO JI;

if (joyGetPos(JOYSTICKID1, &amp;JI)==JOYERR_NOERROR){
          Xpos = JI.wXpos; //Position der X-Achse
   Ypos = JI.wYpos; //Position der Y-Achse
  }
  return 0;
}
</code></pre>
<p>das wars dann auch schon <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title="=)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1182528</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1182528</guid><dc:creator><![CDATA[alex2603]]></dc:creator><pubDate>Mon, 27 Nov 2006 16:57:43 GMT</pubDate></item></channel></rss>