<?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[API korrekt?]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;math.h&gt;
#include &lt;iostream.h&gt;
#include &lt;windows.h&gt;

using namespace std; 

int main() {
  POINT mPos;
    while(1) {
     if(GetAsyncKeyState(VK_RBUTTON)) {
      GetCursorPos(&amp;mPos);
      cout &lt;&lt; &quot;X:&quot; &lt;&lt; mPos.x &lt;&lt; &quot;  Y:&quot; &lt;&lt; mPos.y &lt;&lt; endl;
      system(&quot;CLS&quot;);
     }
    } 
	return 0;
}
</code></pre>
<p>Ersetze ich GetAsyncKeyState(VK_RBUTTON) durch eine 1, klappt es.<br />
Nur so nicht. Warum? Wenn die rechte maustaste gedrückt ist, sollen nur die koordinaten angezeigt werden. Sonst nicht.</p>
<p>Kann mir wer helfen?</p>
<p>(Es klappt insofern nicht, dass die konsole zwar kommt, aber unendlich (scheinbar) läd. Nach 2 Stunden habe ich sie dann geschlossen.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/211419/api-korrekt</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 15:25:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/211419.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 22 Apr 2008 22:46:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to API korrekt? on Tue, 22 Apr 2008 22:46:23 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;math.h&gt;
#include &lt;iostream.h&gt;
#include &lt;windows.h&gt;

using namespace std; 

int main() {
  POINT mPos;
    while(1) {
     if(GetAsyncKeyState(VK_RBUTTON)) {
      GetCursorPos(&amp;mPos);
      cout &lt;&lt; &quot;X:&quot; &lt;&lt; mPos.x &lt;&lt; &quot;  Y:&quot; &lt;&lt; mPos.y &lt;&lt; endl;
      system(&quot;CLS&quot;);
     }
    } 
	return 0;
}
</code></pre>
<p>Ersetze ich GetAsyncKeyState(VK_RBUTTON) durch eine 1, klappt es.<br />
Nur so nicht. Warum? Wenn die rechte maustaste gedrückt ist, sollen nur die koordinaten angezeigt werden. Sonst nicht.</p>
<p>Kann mir wer helfen?</p>
<p>(Es klappt insofern nicht, dass die konsole zwar kommt, aber unendlich (scheinbar) läd. Nach 2 Stunden habe ich sie dann geschlossen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1496533</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1496533</guid><dc:creator><![CDATA[Puenktchen]]></dc:creator><pubDate>Tue, 22 Apr 2008 22:46:23 GMT</pubDate></item><item><title><![CDATA[Reply to API korrekt? on Wed, 23 Apr 2008 04:43:28 GMT]]></title><description><![CDATA[<p>Hier nochmal die erweiterte datei:<br />
Es wird nur einmal kjp ausgegebn.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;windows.h&gt;
#include &lt;winuser.h&gt;
#include &lt;math.h&gt;
#include &lt;stdio.h&gt;

// hier fängt der main teil an
int main() {

POINT mPos;
BOOL rc;
int x,y;
long lx,ly;
float dx,dy;
short dif=60;

 while(1) {

   if(GetAsyncKeyState(VK_RBUTTON)) { // rechte Maustaste gedrückt?
    printf(&quot;kjp&quot;);

    rc = GetCursorPos(&amp;mPos);  
    x = mPos.x;
    y = mPos.y;
    Sleep(500);

    dx = x - lx;
    dy = y - ly;
    if(dx&gt;dif || dy&gt;dif) {

      // Rückgabewert entspricht Ziffer auf Nummernpad
      if( (fabs(dx)&lt;dif) &amp;&amp; (fabs(dy)&lt;dif) ) printf(&quot;0&quot;);;
        if( fabs(dx) &lt; fabs( dy / 2 ) ) {
          // vertikale Bewegung
          if( dy &gt; 0 ) printf(&quot;2&quot;);;
          if( dy &lt; 0 ) printf(&quot;8&quot;);;
        }

      if( fabs(dy) &lt; fabs( dx / 2 ) ) {
        // horizontale Bewegung
        if( dx &gt; 0 ) printf(&quot;6&quot;);;
        if( dx &lt; 0 ) printf(&quot;4&quot;);;
      }

     // Diagonale Bewegung
     if( (dx &gt; 0) &amp;&amp; (dy &gt; 0 ) ) printf(&quot;3&quot;);;
     if( (dx &gt; 0) &amp;&amp; (dy &lt; 0 ) ) printf(&quot;9&quot;);;
     if( (dx &lt; 0) &amp;&amp; (dy &gt; 0 ) ) printf(&quot;1&quot;);;
     if( (dx &lt; 0) &amp;&amp; (dy &lt; 0 ) ) printf(&quot;7&quot;);;

    //cout &lt;&lt; x &lt;&lt; dx &lt;&lt; lx &lt;&lt; endl;
    //cout &lt;&lt; y &lt;&lt; dy &lt;&lt; ly &lt;&lt; endl;

      x = 0;
      lx = 0;
      y = 0;
      ly = 0;
      dy = 0;
      dx = 0;
}
return 0;
  }
}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1496553</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1496553</guid><dc:creator><![CDATA[Puenktchen]]></dc:creator><pubDate>Wed, 23 Apr 2008 04:43:28 GMT</pubDate></item><item><title><![CDATA[Reply to API korrekt? on Wed, 23 Apr 2008 05:56:40 GMT]]></title><description><![CDATA[<p>Also bei mir klappt dein Code tadellos! Ich habe nur die Header angepasst, damit es sich kompilieren lässt.</p>
<pre><code class="language-cpp">#include &lt;math.h&gt;
#include &lt;iostream&gt;   //&lt;iostream.h&gt; zu &lt;iostream&gt; geändert
#include &lt;windows.h&gt; 

using namespace std; 

int main() { 
  POINT mPos; 
  while(1) { 
    if(GetAsyncKeyState(VK_RBUTTON)) { 
      GetCursorPos(&amp;mPos); 
      cout &lt;&lt; &quot;X:&quot; &lt;&lt; mPos.x &lt;&lt; &quot;  Y:&quot; &lt;&lt; mPos.y &lt;&lt; endl; 
      system(&quot;CLS&quot;); 
    } 
  } 
  return 0; 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1496580</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1496580</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Wed, 23 Apr 2008 05:56:40 GMT</pubDate></item><item><title><![CDATA[Reply to API korrekt? on Wed, 23 Apr 2008 12:52:12 GMT]]></title><description><![CDATA[<p>Ja, ist korrekt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1496851</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1496851</guid><dc:creator><![CDATA[real_rofler]]></dc:creator><pubDate>Wed, 23 Apr 2008 12:52:12 GMT</pubDate></item><item><title><![CDATA[Reply to API korrekt? on Wed, 23 Apr 2008 13:17:48 GMT]]></title><description><![CDATA[<p>du wertest den rückgabewert von GetAsyncKeyState nicht richtig aus, man muss testen ob das &quot;most significant bit&quot; gesetzt ist</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1496877</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1496877</guid><dc:creator><![CDATA[&#x2F;&#x2F;]]></dc:creator><pubDate>Wed, 23 Apr 2008 13:17:48 GMT</pubDate></item><item><title><![CDATA[Reply to API korrekt? on Wed, 23 Apr 2008 13:29:52 GMT]]></title><description><![CDATA[<blockquote>
<p>GetAsyncKeyState nicht richtig aus, man muss testen ob das &quot;most significant bit&quot; gesetzt ist</p>
</blockquote>
<p>kannst du dich bitte erklären?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1496892</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1496892</guid><dc:creator><![CDATA[Puenktchen]]></dc:creator><pubDate>Wed, 23 Apr 2008 13:29:52 GMT</pubDate></item><item><title><![CDATA[Reply to API korrekt? on Wed, 23 Apr 2008 13:38:38 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">if(GetAsyncKeyState(VK_RBUTTON) &amp; 0x8000)
{
    // rechte Maustaste ist unten
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1496902</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1496902</guid><dc:creator><![CDATA[keine erklärung]]></dc:creator><pubDate>Wed, 23 Apr 2008 13:38:38 GMT</pubDate></item></channel></rss>