<?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[SendMessage()]]></title><description><![CDATA[<p>hallihallo,</p>
<p>kann ich mit SendMessage() einen Tastendruck simulieren?<br />
und zwar im FEnster hwnd?</p>
<pre><code class="language-cpp">SendMessage(hWnd, WM_KEYDOWN, VK_MENU, 0xb8);
 SendMessage(hWnd, WM_KEYUP, VK_MENU, 0xb8);
</code></pre>
<p>weil das klappt irgendwie nicht, folgende Fehlermeldung:</p>
<blockquote>
<p>.../CodeBlocks/include/winuser.h:3514: error: too few arguments to function `HWND__* GetParent(HWND__*)'<br />
main.cpp:68: error: at this point in file<br />
main.cpp:68: error: 'struct HWND__' has no member named 'SendMessageA'</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/topic/177402/sendmessage</link><generator>RSS for Node</generator><lastBuildDate>Wed, 24 Jun 2026 14:23:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/177402.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 30 Mar 2007 23:49:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to SendMessage() on Fri, 30 Mar 2007 23:49:38 GMT]]></title><description><![CDATA[<p>hallihallo,</p>
<p>kann ich mit SendMessage() einen Tastendruck simulieren?<br />
und zwar im FEnster hwnd?</p>
<pre><code class="language-cpp">SendMessage(hWnd, WM_KEYDOWN, VK_MENU, 0xb8);
 SendMessage(hWnd, WM_KEYUP, VK_MENU, 0xb8);
</code></pre>
<p>weil das klappt irgendwie nicht, folgende Fehlermeldung:</p>
<blockquote>
<p>.../CodeBlocks/include/winuser.h:3514: error: too few arguments to function `HWND__* GetParent(HWND__*)'<br />
main.cpp:68: error: at this point in file<br />
main.cpp:68: error: 'struct HWND__' has no member named 'SendMessageA'</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1256381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1256381</guid><dc:creator><![CDATA[supersass1]]></dc:creator><pubDate>Fri, 30 Mar 2007 23:49:38 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sat, 31 Mar 2007 07:59:34 GMT]]></title><description><![CDATA[<p>Probier's mal so zu machen:</p>
<pre><code>SendMessage(hWnd, WM_KEYDOWN, (WPARAM)(LPCTSTR)VK_MENU, (LPARAM)(LPCTSTR)0xb8);
</code></pre>
<p>Kannst dir ja mal das hier ansehen:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-165868.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-165868.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1256409</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1256409</guid><dc:creator><![CDATA[GNUnix]]></dc:creator><pubDate>Sat, 31 Mar 2007 07:59:34 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sat, 31 Mar 2007 09:30:44 GMT]]></title><description><![CDATA[<p>dankeschön für die schnelle Antwort,</p>
<p>es kommt zwar keine Fehlermeldung, aber funktionieren scheint es auch nicht.<br />
Was mach ich falsch?</p>
<pre><code class="language-cpp">SendMessage(hWnd, WM_KEYDOWN, (WPARAM)(LPCTSTR)VK_MENU, (LPARAM)(LPCTSTR)0xb8);
	    SendMessage(hWnd, WM_KEYDOWN, (WPARAM)(LPCTSTR)VkKeyScan('I'), (LPARAM)(LPCTSTR)0x97);
	   SendMessage(hWnd, WM_KEYUP, (WPARAM)(LPCTSTR)VK_MENU, (LPARAM)(LPCTSTR)0xb8);
	    SendMessage(hWnd, WM_KEYUP, (WPARAM)(LPCTSTR)VkKeyScan('I'), (LPARAM)(LPCTSTR)0x97);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1256458</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1256458</guid><dc:creator><![CDATA[supersass1]]></dc:creator><pubDate>Sat, 31 Mar 2007 09:30:44 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sat, 31 Mar 2007 09:35:07 GMT]]></title><description><![CDATA[<p>supersass1 schrieb:</p>
<blockquote>
<blockquote>
<p>.../CodeBlocks/include/winuser.h:3514: error: too few arguments to function `HWND__* GetParent(HWND__*)'<br />
main.cpp:68: error: at this point in file<br />
main.cpp:68: error: 'struct HWND__' has no member named 'SendMessageA'</p>
</blockquote>
</blockquote>
<p>Ich glaub, das spricht für sich. Was hast du genau in Zeile 68 stehen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1256461</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1256461</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Sat, 31 Mar 2007 09:35:07 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sat, 31 Mar 2007 09:52:05 GMT]]></title><description><![CDATA[<p>nein jetzt hab ich keine Fehlermeldung mehr...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1256476</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1256476</guid><dc:creator><![CDATA[supersass1]]></dc:creator><pubDate>Sat, 31 Mar 2007 09:52:05 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sat, 31 Mar 2007 09:54:02 GMT]]></title><description><![CDATA[<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1256481</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1256481</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Sat, 31 Mar 2007 09:54:02 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sat, 31 Mar 2007 12:12:18 GMT]]></title><description><![CDATA[<p>supersass1 schrieb:</p>
<blockquote>
<p>dankeschön für die schnelle Antwort,</p>
<p>es kommt zwar keine Fehlermeldung, aber funktionieren scheint es auch nicht.<br />
Was mach ich falsch?</p>
<pre><code class="language-cpp">SendMessage(hWnd, WM_KEYDOWN, (WPARAM)(LPCTSTR)VK_MENU, (LPARAM)(LPCTSTR)0xb8);
	    SendMessage(hWnd, WM_KEYDOWN, (WPARAM)(LPCTSTR)VkKeyScan('I'), (LPARAM)(LPCTSTR)0x97);
	   SendMessage(hWnd, WM_KEYUP, (WPARAM)(LPCTSTR)VK_MENU, (LPARAM)(LPCTSTR)0xb8);
	    SendMessage(hWnd, WM_KEYUP, (WPARAM)(LPCTSTR)VkKeyScan('I'), (LPARAM)(LPCTSTR)0x97);
</code></pre>
</blockquote>
<p>also es passiert einfach nichts.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1256549</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1256549</guid><dc:creator><![CDATA[supersass1]]></dc:creator><pubDate>Sat, 31 Mar 2007 12:12:18 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sat, 31 Mar 2007 17:10:05 GMT]]></title><description><![CDATA[<p>Woher oder wie kriegst du denn das Handle(hWnd)?<br />
Oder was für ein Programm willst du denn schreiben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1256732</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1256732</guid><dc:creator><![CDATA[GNUnix]]></dc:creator><pubDate>Sat, 31 Mar 2007 17:10:05 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sat, 31 Mar 2007 22:51:22 GMT]]></title><description><![CDATA[<p>mit dieser Funktion bekommen ich hWnd:</p>
<pre><code class="language-cpp">HWND hWnd;

int findwindow()
{
    HWND hWnd;
HANDLE hproc;
DWORD procid;
DWORD rw = 0;

unsigned adress = 0x001504BC;  //0x11A9FBE7;
char buffer[512];

hWnd = FindWindow(0,&quot;Warcraft III&quot;);
if(!hWnd) {
cout &lt;&lt; &quot;Fenster nicht Gefunden!&quot; &lt;&lt; endl;
} else {
cout &lt;&lt; &quot;Fenster Gefunden!&quot; &lt;&lt; endl;
}

ShowWindow(hWnd, SW_MAXIMIZE);
}
</code></pre>
<p>ich möchte lediglich mit SendMessage einen Tastendruck simulieren.<br />
Ich will damit erreichen, dass man ohne das Fenster, in diesem Fall Warcraft III, einen Tastendruck simulieren kann, quasi im Hintergrund...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1256895</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1256895</guid><dc:creator><![CDATA[supersass1]]></dc:creator><pubDate>Sat, 31 Mar 2007 22:51:22 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sun, 01 Apr 2007 08:24:39 GMT]]></title><description><![CDATA[<p>Wahrscheinlich arbeitet dein Spiel nicht mit Messages(ist für Spiele zu langsam). Mit anderen Funktionen wird die gedrücke Taste aus dem Puffer gelesen und ich glaube nicht, dass SendMessage an diesem Puffer, was ändert.</p>
<p>Informier probier's mal mit dieser Funktion:</p>
<pre><code class="language-cpp">keybd_event(VirtualKeyCode, 0, 0L, 0L);
keybd_event(VirtualKeyCode, 0, KEYEVENTF_KEYUP, 0L);
</code></pre>
<p>MfG</p>
<p>GNUnix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1256966</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1256966</guid><dc:creator><![CDATA[GNUnix]]></dc:creator><pubDate>Sun, 01 Apr 2007 08:24:39 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sun, 01 Apr 2007 09:20:35 GMT]]></title><description><![CDATA[<p>ja damit funktioniert es, aber damit muss das Fenster auch im Vordergrund sein, sprich markiert sein. Und das wollte ich ja gerade vermeiden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1256999</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1256999</guid><dc:creator><![CDATA[supersass1]]></dc:creator><pubDate>Sun, 01 Apr 2007 09:20:35 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sun, 01 Apr 2007 10:44:31 GMT]]></title><description><![CDATA[<p>Wird bei SetFocus, das Fenster auch nach vorne versetzt? Das weiß ich nicht genau!<br />
Kannst dich ja mal darüber in Google informieren, denn mit SendMessage wird's nich klappen, da es ein Spiel ist.</p>
<p>MfG</p>
<p>GNUnix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1257048</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1257048</guid><dc:creator><![CDATA[GNUnix]]></dc:creator><pubDate>Sun, 01 Apr 2007 10:44:31 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sun, 01 Apr 2007 11:38:33 GMT]]></title><description><![CDATA[<p>nein, das Fenster wird nicht nach vorne versetzt.</p>
<p>Aber es funktioniert aber auch nicht so wie ich es mir vorstelle.</p>
<p>also hWnd ist richtig deklariert, der Code:</p>
<pre><code class="language-cpp">SetFocus(hWnd);
      keybd_event(VK_MENU,0xb8,0 , 0); // Alt Press
      keybd_event(VkKeyScan('I'),0x97,0 , 0); // ‘I’ Press
      keybd_event(VkKeyScan('I'),0x97, KEYEVENTF_KEYUP,0); // ‘i’ Release
      keybd_event(VK_MENU,0xb8,KEYEVENTF_KEYUP,0); // Alt Release
</code></pre>
<p>Es geschieht leider irgendwie gar nichts.<br />
Woher weiß der Compiler denn, dass sich das SetFocus auf alle keybd_event()s bezieht?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1257090</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1257090</guid><dc:creator><![CDATA[supersass1]]></dc:creator><pubDate>Sun, 01 Apr 2007 11:38:33 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sun, 01 Apr 2007 18:29:57 GMT]]></title><description><![CDATA[<p>Das interessiert den Compiler nicht. Es wird mit dieser Funktion der Fokus(im Betriebssystem, also Windows) auf dieses Fenster gesetzt und keybd_event simuliert schickt den Tastendruck an das fokusierte Fenster.</p>
<p>Probier es mal so:</p>
<pre><code class="language-cpp">keybd_event(VK_MENU, 0, 0, 0);
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
</code></pre>
<p>MfG</p>
<p>GNUnix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1257553</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1257553</guid><dc:creator><![CDATA[GNUnix]]></dc:creator><pubDate>Sun, 01 Apr 2007 18:29:57 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sun, 01 Apr 2007 18:32:14 GMT]]></title><description><![CDATA[<p>ja das bringt ja nichts, ich bruach die Kombination mit ALT + I sonst seh ich das ja nicht, ob er das wirklich simuliert hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1257563</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1257563</guid><dc:creator><![CDATA[supersass1]]></dc:creator><pubDate>Sun, 01 Apr 2007 18:32:14 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sun, 01 Apr 2007 18:39:23 GMT]]></title><description><![CDATA[<p>Setz mal zwischen dem Tastendruck und das Lösen eine kurze Warteroutine(sleep oder so) ein. Vielleicht muss das Spiel den Tastendruck erst registrieren.</p>
<p>Oder so mit SendInput():</p>
<pre><code class="language-cpp">INPUT ipSignal;
    ipSignal.type           = INPUT_KEYBOARD;
    ipSignal.ki.wVk         = byVirtualKeyCode;
    ipSignal.ki.wScan       = 0;
    ipSignal.ki.dwFlags     = 0L;
    ipSignal.ki.time        = 0L;
    ipSignal.ki.dwExtraInfo = 0L;
    SendInput(1, &amp;ipSignal, sizeof(ipSignal));

    ipSignal.ki.dwFlags     = KEYEVENTF_KEYUP;
    SendInput(1, &amp;ipSignal, sizeof(ipSignal));
</code></pre>
<p>MfG</p>
<p>GNUnix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1257566</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1257566</guid><dc:creator><![CDATA[GNUnix]]></dc:creator><pubDate>Sun, 01 Apr 2007 18:39:23 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sun, 01 Apr 2007 19:40:42 GMT]]></title><description><![CDATA[<blockquote>
<p>Woher weiß der Compiler denn, dass sich das SetFocus auf alle keybd_event()s bezieht?!</p>
</blockquote>
<p>Gar nicht, da hier wirklich ein Tastendruck simuliert wird. Also nicht bloß einem Fenster es mitgeteilt sondern allen laufenden Programmen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1257605</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1257605</guid><dc:creator><![CDATA[Ben04]]></dc:creator><pubDate>Sun, 01 Apr 2007 19:40:42 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Sun, 01 Apr 2007 21:56:44 GMT]]></title><description><![CDATA[<p>Ben04 schrieb:</p>
<blockquote>
<blockquote>
<p>Woher weiß der Compiler denn, dass sich das SetFocus auf alle keybd_event()s bezieht?!</p>
</blockquote>
<p>Gar nicht, da hier wirklich ein Tastendruck simuliert wird. Also nicht bloß einem Fenster es mitgeteilt sondern allen laufenden Programmen.</p>
</blockquote>
<p>und was bringt dann SetFocus() ?<br />
Sprich, SetFcous bringt in Kombination mit keybd_event nichts, mit SendInput jedoch doch?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1257681</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1257681</guid><dc:creator><![CDATA[supersass1]]></dc:creator><pubDate>Sun, 01 Apr 2007 21:56:44 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Mon, 02 Apr 2007 08:43:31 GMT]]></title><description><![CDATA[<p>Der Fokus ist im Betriebssystem Windows verankert, durch SetFocus wird diese Variable, Pointer oder was auch immmer auf das neue Fenster gesetzt. keybd_event sendet alle Keyboard-Events an das fokusierte Fenster. Also das hat nix mit dem Compiler zu tun, sondern mit dem Betriebssystem.</p>
<p>MfG</p>
<p>GNUnix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1257771</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1257771</guid><dc:creator><![CDATA[GNUnix]]></dc:creator><pubDate>Mon, 02 Apr 2007 08:43:31 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Mon, 02 Apr 2007 16:04:41 GMT]]></title><description><![CDATA[<p>Ben04 schrieb:</p>
<blockquote>
<p>Gar nicht, da hier wirklich ein Tastendruck simuliert wird. Also nicht bloß einem Fenster es mitgeteilt sondern allen laufenden Programmen.</p>
</blockquote>
<blockquote>
<p>...keybd_event sendet alle Keyboard-Events an das fokusierte Fenster. Also das hat nix mit dem Compiler zu tun, sondern mit dem Betriebssystem.</p>
</blockquote>
<p>das widerspricht sich aber.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258088</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258088</guid><dc:creator><![CDATA[supersass1]]></dc:creator><pubDate>Mon, 02 Apr 2007 16:04:41 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Mon, 02 Apr 2007 22:36:00 GMT]]></title><description><![CDATA[<p>Ben04 schrieb:</p>
<blockquote>
<p>Gar nicht, da hier wirklich ein Tastendruck simuliert wird. Also nicht bloß einem Fenster es mitgeteilt sondern allen laufenden Programmen.</p>
</blockquote>
<p>Das stimmt auch nicht. Was GNUnix schreibt, ist schon richtig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258234</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258234</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Mon, 02 Apr 2007 22:36:00 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Tue, 03 Apr 2007 15:48:03 GMT]]></title><description><![CDATA[<p>LOL, was ein Thread...<br />
<a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7622">@supersass1</a>, guckst Du hier <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/27a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--right_arrow"
      title=":arrow_right:"
      alt="➡"
    /> <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-165868.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-165868.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258700</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258700</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Tue, 03 Apr 2007 15:48:03 GMT</pubDate></item><item><title><![CDATA[Reply to SendMessage() on Wed, 04 Apr 2007 12:41:56 GMT]]></title><description><![CDATA[<p>ja den Thread kenn ich..<br />
mir ging es jetzt daruaf, auf ein Fenster im <strong>Hintergrund</strong> einen Tastendruck zu simulieren, so das der User praktisch noch nebenbei etwas machen kann.</p>
<p>und übrgigens, mit SetFocus() erreicht ich nicht das, was ich wollte s.o.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258738</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258738</guid><dc:creator><![CDATA[supersass1]]></dc:creator><pubDate>Wed, 04 Apr 2007 12:41:56 GMT</pubDate></item></channel></rss>