<?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[Thread in C++ für Tastendrucksimulation]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich habe vor das ich einen Tastendrucksimulation programmier jedoch steh ich vor dem follgenden Problem, wenn ich den folgenden Code ausführe wird nur zwei mal s gedrückt und nicht so wie gewollt das die Taste s eine Sekunde lang gedrückt wird, darum dachte ich gibt es in C++ so was ähnliches wie einen Thread?</p>
<p>Danke schon mal!</p>
<pre><code>int main(int argc, char *argv[])
{
    HWND hwnd = FindWindow(NULL, &quot;Eingabeaufforderung&quot;);
    SetForegroundWindow(hwnd); 

    PostMessage(hwnd, WM_KEYDOWN, 0x53, 0 );
    Sleep(1000);
    PostMessage(hwnd, WM_KEYUP, 0x53, 0 );

    return EXIT_SUCCESS;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/176997/thread-in-c-für-tastendrucksimulation</link><generator>RSS for Node</generator><lastBuildDate>Sat, 19 Sep 2026 16:22:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/176997.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 27 Mar 2007 08:55:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Thread in C++ für Tastendrucksimulation on Tue, 27 Mar 2007 08:55:00 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich habe vor das ich einen Tastendrucksimulation programmier jedoch steh ich vor dem follgenden Problem, wenn ich den folgenden Code ausführe wird nur zwei mal s gedrückt und nicht so wie gewollt das die Taste s eine Sekunde lang gedrückt wird, darum dachte ich gibt es in C++ so was ähnliches wie einen Thread?</p>
<p>Danke schon mal!</p>
<pre><code>int main(int argc, char *argv[])
{
    HWND hwnd = FindWindow(NULL, &quot;Eingabeaufforderung&quot;);
    SetForegroundWindow(hwnd); 

    PostMessage(hwnd, WM_KEYDOWN, 0x53, 0 );
    Sleep(1000);
    PostMessage(hwnd, WM_KEYUP, 0x53, 0 );

    return EXIT_SUCCESS;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1253617</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253617</guid><dc:creator><![CDATA[elements]]></dc:creator><pubDate>Tue, 27 Mar 2007 08:55:00 GMT</pubDate></item><item><title><![CDATA[Reply to Thread in C++ für Tastendrucksimulation on Tue, 27 Mar 2007 08:56:59 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Im Standard gibt es keine Threads, aber du kannst dir ja mal boost anschauen.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253619</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253619</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Tue, 27 Mar 2007 08:56:59 GMT</pubDate></item><item><title><![CDATA[Reply to Thread in C++ für Tastendrucksimulation on Tue, 27 Mar 2007 10:59:32 GMT]]></title><description><![CDATA[<p>darf ich kurz fragen, welche header du eingebunden hast?</p>
<p>(weil das würde mir ungemein weiter helfen)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253701</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253701</guid><dc:creator><![CDATA[supersass1]]></dc:creator><pubDate>Tue, 27 Mar 2007 10:59:32 GMT</pubDate></item><item><title><![CDATA[Reply to Thread in C++ für Tastendrucksimulation on Tue, 27 Mar 2007 11:24:27 GMT]]></title><description><![CDATA[<p>chrische5 schrieb:</p>
<blockquote>
<p>Im Standard gibt es keine Threads, aber du kannst dir ja mal boost anschauen.</p>
</blockquote>
<p>Andere Frage sollte nicht PostMessage(hwnd, WM_KEYDOWN, 0x53, 0 ); nicht solange gedrückt bleiben bis das KEYUP kommt irgendwie funktioniert das bei mir auch nicht.</p>
<p>supersass1 schrieb:</p>
<blockquote>
<p>darf ich kurz fragen, welche header du eingebunden hast?<br />
(weil das würde mir ungemein weiter helfen)</p>
</blockquote>
<p>windows.h <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253719</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253719</guid><dc:creator><![CDATA[elements]]></dc:creator><pubDate>Tue, 27 Mar 2007 11:24:27 GMT</pubDate></item><item><title><![CDATA[Reply to Thread in C++ für Tastendrucksimulation on Tue, 27 Mar 2007 11:54:40 GMT]]></title><description><![CDATA[<blockquote>
<p>Andere Frage sollte nicht PostMessage(hwnd, WM_KEYDOWN, 0x53, 0 ); nicht solange gedrückt bleiben bis das KEYUP kommt irgendwie funktioniert das bei mir auch nicht.</p>
</blockquote>
<p>Da scheinst du das Message-Handling der Win-API nicht ganz zu verstehen.<br />
Du setzt zwar das KeyDown-Event ab, aber das heißt noch lange nicht, daß Windows dann solange KeyDown-Events selber sendet, bis irgendwer ein Key-Up Event auslöst. Fazit: Das mußt du schon selber programmieren...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253744</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253744</guid><dc:creator><![CDATA[Th]]></dc:creator><pubDate>Tue, 27 Mar 2007 11:54:40 GMT</pubDate></item></channel></rss>