<?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[Schnellerer Timer als WM_TIMER]]></title><description><![CDATA[<p>Gibt es einen Timer, der schneller ist als die WM_TIMER Nachricht? Denn die kann leider nur minimum ca. 50ms.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/158548/schnellerer-timer-als-wm_timer</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Jul 2026 21:49:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/158548.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 06 Sep 2006 12:59:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Schnellerer Timer als WM_TIMER on Wed, 06 Sep 2006 12:59:42 GMT]]></title><description><![CDATA[<p>Gibt es einen Timer, der schneller ist als die WM_TIMER Nachricht? Denn die kann leider nur minimum ca. 50ms.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1132295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1132295</guid><dc:creator><![CDATA[Milhous]]></dc:creator><pubDate>Wed, 06 Sep 2006 12:59:42 GMT</pubDate></item><item><title><![CDATA[Reply to Schnellerer Timer als WM_TIMER on Wed, 06 Sep 2006 13:02:47 GMT]]></title><description><![CDATA[<p>Forensuche-&gt;*QueryPerformanceCounter*</p>
<p>Aber vergiss es, bei 10ms hast du schon mindestens 5% Abweichung.<br />
Für solch kurze Zeitabstände ist Windows nicht geschaffen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1132299</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1132299</guid><dc:creator><![CDATA[THX 1138]]></dc:creator><pubDate>Wed, 06 Sep 2006 13:02:47 GMT</pubDate></item><item><title><![CDATA[Reply to Schnellerer Timer als WM_TIMER on Wed, 06 Sep 2006 13:15:49 GMT]]></title><description><![CDATA[<p>hallo, da ich eine ähnliche frage habe poste ich einfach mal hier rein.<br />
mein programm soll in vorgegebenen zeitabständen aktionen ausführen. Für mich kommt SetTimer() nicht in Frage, da ich hier ein fixes Zeitintervall angeben muss - meine zeitabstände ändern sich aber.<br />
Ich probierte dann sowas (pseudocode):<br />
while(1){<br />
i = GetTickCount();<br />
while(GetTickCount() - i &lt; irgend_ein_intervall_das_sich_oft_ändert)<br />
Sleep(XXX);<br />
}</p>
<p>So wenn ich jetzt für XXX 0 schreibe, habe ich 100% CPU auslastung, wasich nicht verstehe - ich meine mal gelesen zu warten, dass Sleep(0) zu anderen threads schaltet die rechenzeit brauchen. Also nahm ich einfach mal Sleep(1). Das funktioniert auch gut, ich hab 0% CPU-Auslastung, aber: sobald irgend ein programm bissl rechenzeit braucht (z.b. wenn man ein programm startet oder eni programm was auf die festplatte schreibt) wird die schleife extrem ungenau. Es kommen eben mal 2 Schleifendurchläufe schnell hintereinander etc.<br />
Welche Möglichkeiten stehen mir zur verfügung?<br />
also ich will:</p>
<ol>
<li>nicht 100% CPU-Auslastung</li>
<li>Auflösung im ms-Bereich</li>
<li>Die Abweichung darf gerne 10 ms Sekunden betragen, soll aber nicht völlig aus dem Rhythmus kommen, wenn andere Programme Rechenzeit brauchen.</li>
<li>Die Wartezeit muss dynamisch sein dürfen.</li>
</ol>
<p>Danke, MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1132312</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1132312</guid><dc:creator><![CDATA[fragender0815]]></dc:creator><pubDate>Wed, 06 Sep 2006 13:15:49 GMT</pubDate></item><item><title><![CDATA[Reply to Schnellerer Timer als WM_TIMER on Wed, 06 Sep 2006 13:36:07 GMT]]></title><description><![CDATA[<p>@Milhous:<br />
Oder <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://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_timesetevent.asp" rel="nofollow">timeSetEvent(...)</a></p>
<p>Milhous schrieb:</p>
<blockquote>
<p>[...]Denn die kann leider nur minimum ca. 50ms.</p>
</blockquote>
<p>Ich meine es waren 20 Millisekunden, aber is auch wurscht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1132330</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1132330</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Wed, 06 Sep 2006 13:36:07 GMT</pubDate></item><item><title><![CDATA[Reply to Schnellerer Timer als WM_TIMER on Wed, 06 Sep 2006 13:46:47 GMT]]></title><description><![CDATA[<p>In der MSDN steht:</p>
<blockquote>
<p>Requirements<br />
Windows XP: Included in Windows XP only.<br />
Header: Declared in Mmsystem.h; include Windows.h.<br />
Library: Use Winmm.lib.</p>
</blockquote>
<p>Auch wenn ich selbst auf Windows XP programmiere, benutze ich nicht gern Funktionen, die auf ein bestimmtes Windows begrenzt sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1132341</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1132341</guid><dc:creator><![CDATA[Milhous]]></dc:creator><pubDate>Wed, 06 Sep 2006 13:46:47 GMT</pubDate></item><item><title><![CDATA[Reply to Schnellerer Timer als WM_TIMER on Wed, 06 Sep 2006 13:47:49 GMT]]></title><description><![CDATA[<blockquote>
<p>Für solch kurze Zeitabstände ist Windows nicht geschaffen.</p>
</blockquote>
<p>Wie realisiert man dann zb eine Bewegung in einem Spiel?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1132342</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1132342</guid><dc:creator><![CDATA[Milhous]]></dc:creator><pubDate>Wed, 06 Sep 2006 13:47:49 GMT</pubDate></item><item><title><![CDATA[Reply to Schnellerer Timer als WM_TIMER on Wed, 06 Sep 2006 14:18:19 GMT]]></title><description><![CDATA[<p>Milhous schrieb:</p>
<blockquote>
<p>Gibt es einen Timer, der schneller ist als die WM_TIMER Nachricht?</p>
</blockquote>
<p>Wenn ich mich recht entsinne ging es dir ja um einen alternativen <strong>Timer</strong> und QueryPerf... ermittelt ja nur einen ('sehr genauen') Zeitwert. Obwohl ich deine Meinung natürlich nachvollziehen kann <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/1132368</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1132368</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Wed, 06 Sep 2006 14:18:19 GMT</pubDate></item><item><title><![CDATA[Reply to Schnellerer Timer als WM_TIMER on Wed, 06 Sep 2006 14:32:17 GMT]]></title><description><![CDATA[<p>Milhous schrieb:</p>
<blockquote>
<p>In der MSDN steht:</p>
<blockquote>
<p>Requirements<br />
Windows XP: Included in Windows XP only.<br />
Header: Declared in Mmsystem.h; include Windows.h.<br />
Library: Use Winmm.lib.</p>
</blockquote>
<p>Auch wenn ich selbst auf Windows XP programmiere, benutze ich nicht gern Funktionen, die auf ein bestimmtes Windows begrenzt sind.</p>
</blockquote>
<p>Leider ist die MSDN-Doku auch nicht immer 100%ig korrekt.<br />
Da ist MS ein Fehler unterlaufen...</p>
<p>Es sollte natürlich heissen:</p>
<blockquote>
<p>Windows NT/2000/XP: Included in Windows NT 3.1 and later.<br />
Windows 95/98/Me: Included in Windows 95 and later.</p>
</blockquote>
<p>(wie bei allen anderen &quot;timeXxx&quot; Funktionen auch. Nur ein Flag ist bei XP dazugekommen (AFAIK TIME_KILL_SYNCHRONOUS, muss aber dahaim nochmals nachschauen).</p>
<p>Ich würde schon zu diesen Funktionen Raten. auch kannst Du die &quot;timeBeginPeriod die Auflösung des OSs verändern (was sich aber *global* auswirkt!!!).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1132380</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1132380</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Wed, 06 Sep 2006 14:32:17 GMT</pubDate></item><item><title><![CDATA[Reply to Schnellerer Timer als WM_TIMER on Wed, 06 Sep 2006 14:33:35 GMT]]></title><description><![CDATA[<p>Milhous schrieb:</p>
<blockquote>
<p>Wie realisiert man dann zb eine Bewegung in einem Spiel?</p>
</blockquote>
<p>Du kannst mal im Spiele-Forum posten; aber prinzipiell: Du verwendest den Multimedia-Timer und errechnest beim Aufruf des Timer-Events, wie viel Zeit vergangen ist und was Du wohin bewegen musst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1132383</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1132383</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Wed, 06 Sep 2006 14:33:35 GMT</pubDate></item><item><title><![CDATA[Reply to Schnellerer Timer als WM_TIMER on Wed, 06 Sep 2006 14:48:31 GMT]]></title><description><![CDATA[<p>Nein in Spielen verwendet man fast immer ne QueryPerformanceCounter Schleife.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1132400</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1132400</guid><dc:creator><![CDATA[isdaf]]></dc:creator><pubDate>Wed, 06 Sep 2006 14:48:31 GMT</pubDate></item><item><title><![CDATA[Reply to Schnellerer Timer als WM_TIMER on Wed, 06 Sep 2006 16:11:59 GMT]]></title><description><![CDATA[<p>Oder bastel dir ne kleine Timer-Klasse</p>
<pre><code class="language-cpp">class CPreciseTimer
{
public:
    CPreciseTimer();
    bool SupportsHighResCounter();
    void StartTimer();
    void StopTimer();
    __int64 GetTime();
};
</code></pre>
<p>von <a href="http://www.codeproject.com/cpp/precisetimer.asp?df=100&amp;forumid=2724&amp;exp=0&amp;select=910119" rel="nofollow">CodeProject</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1132487</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1132487</guid><dc:creator><![CDATA[THX 1138]]></dc:creator><pubDate>Wed, 06 Sep 2006 16:11:59 GMT</pubDate></item></channel></rss>