<?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[was brauch ich?  Timer?]]></title><description><![CDATA[<p>folgendes problem, ich will wie wahrscheinlich schon viele leute hier gewollt haben und nach hilfe gefragt haben, neben dem hauptprogramm nebenher noch was laufen lasse, was aber im selben fenster passiert... z.b. dass ich ein prgramm habe, aber während des programms alle 3 sekunden eine variable immer mal 2 gerechnet wird (is jetzt nur n beispiel)! ich glaube dafür brauche ich timer oder threads oder sowas, aber bitte schreibt jetzt nicht nur <a href="http://www.boost.org" rel="nofollow">www.boost.org</a> oder irgendwelche andere seiten, sondern eine detaillierte beschreibung brauch ich...</p>
<p>danke an denjenigen, der sich die zeit dafür nimmt!<br />
mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/160387/was-brauch-ich-timer</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2026 22:05:45 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/160387.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 25 Sep 2006 12:19:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to was brauch ich?  Timer? on Mon, 25 Sep 2006 12:19:39 GMT]]></title><description><![CDATA[<p>folgendes problem, ich will wie wahrscheinlich schon viele leute hier gewollt haben und nach hilfe gefragt haben, neben dem hauptprogramm nebenher noch was laufen lasse, was aber im selben fenster passiert... z.b. dass ich ein prgramm habe, aber während des programms alle 3 sekunden eine variable immer mal 2 gerechnet wird (is jetzt nur n beispiel)! ich glaube dafür brauche ich timer oder threads oder sowas, aber bitte schreibt jetzt nicht nur <a href="http://www.boost.org" rel="nofollow">www.boost.org</a> oder irgendwelche andere seiten, sondern eine detaillierte beschreibung brauch ich...</p>
<p>danke an denjenigen, der sich die zeit dafür nimmt!<br />
mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1144017</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1144017</guid><dc:creator><![CDATA[boost]]></dc:creator><pubDate>Mon, 25 Sep 2006 12:19:39 GMT</pubDate></item><item><title><![CDATA[Reply to was brauch ich?  Timer? on Mon, 25 Sep 2006 12:26:44 GMT]]></title><description><![CDATA[<p>da musste erstmal schreiben was das für'n programm ist.<br />
laeuft es unter windoof oder 'nem unix-like os?<br />
mit fensterchen oder nur textmodus?<br />
usw...???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1144022</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1144022</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Mon, 25 Sep 2006 12:26:44 GMT</pubDate></item><item><title><![CDATA[Reply to was brauch ich?  Timer? on Mon, 25 Sep 2006 12:35:33 GMT]]></title><description><![CDATA[<p>windows DOS sollte das sein benutze Dev-c++ als compiler</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1144028</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1144028</guid><dc:creator><![CDATA[boost]]></dc:creator><pubDate>Mon, 25 Sep 2006 12:35:33 GMT</pubDate></item><item><title><![CDATA[Reply to was brauch ich?  Timer? on Mon, 25 Sep 2006 12:58:23 GMT]]></title><description><![CDATA[<p>Wenn du nur z.B. eine bestimmte funktion alle 3 Sekunden aufrufen willst, dann genügt es in deiner Hauptschleife die Zeit über time() aus ctime abzufragen und gegebenenfalls die Funktion aufzurufen.<br />
Dieses Programm gibt alle 3 Sekunden Hi aus:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;ctime&gt;

using namespace std;

void every3sec()
{
	cout &lt;&lt; &quot;Hi&quot; &lt;&lt; endl;
}

int main()
{
	bool exit(false);
	int exectime = time(0) + 3;
	while (!exit)
	{
		if (exectime == time(0))
		{
			every3sec();
			exectime = time(0) + 3;
		}

	}
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1144048</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1144048</guid><dc:creator><![CDATA[Cappo]]></dc:creator><pubDate>Mon, 25 Sep 2006 12:58:23 GMT</pubDate></item><item><title><![CDATA[Reply to was brauch ich?  Timer? on Mon, 25 Sep 2006 13:29:19 GMT]]></title><description><![CDATA[<p>Gehört zwar ins WinAPI-Forum, aber bitte sehr:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;windows.h&gt;
using namespace std;

unsigned int elapsedTime = 0;

VOID CALLBACK myTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
    cout &lt;&lt; (++elapsedTime) &lt;&lt; endl;
}

int main()
{
    UINT_PTR myTimer = SetTimer(
        0, //Handle zum Fenster (haben wir nicht)
        0, //Identifier für den Event (wenn's mehrere Timer pro Fenster gibt, aber wir haben ja kein Fenster...)
        1000, //Intervall auf 1000 Millisekunden (= 1 Sekunde)
        myTimerProc); //Zeiger auf die Timer-Behandlungs-Funktion

    if(myTimer)
    {
        MSG myMessage;
        while(GetMessage(&amp;myMessage, 0, WM_TIMER, WM_TIMER) &amp;&amp; elapsedTime &lt; 10)
        {
            DispatchMessage(&amp;myMessage); //empfangene Nachricht weiterleiten
            //mache irgendwas (oder auch nicht)
        }
        KillTimer(0, myTimer);
    }
    else
        cout &lt;&lt; &quot;Timer konnte nicht erstellt werden.&quot; &lt;&lt; endl;
}
</code></pre>
<p>Nähere Infos zur WinAPI gibt es im MSDN:<br />
<a href="http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/settimer.asp" rel="nofollow">SetTimer</a><br />
<a href="http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/killtimer.asp" rel="nofollow">KillTimer</a><br />
<a href="http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/timerproc.asp" rel="nofollow">TimerProc</a><br />
<a href="http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/messagesandmessagequeues/messagesandmessagequeuesreference/messagesandmessagequeuesfunctions/getmessage.asp" rel="nofollow">GetMessage</a><br />
<a href="http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/messagesandmessagequeues/messagesandmessagequeuesreference/messagesandmessagequeuesfunctions/dispatchmessage.asp" rel="nofollow">DispatchMessage</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1144071</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1144071</guid><dc:creator><![CDATA[schorsch code]]></dc:creator><pubDate>Mon, 25 Sep 2006 13:29:19 GMT</pubDate></item><item><title><![CDATA[Reply to was brauch ich?  Timer? on Mon, 25 Sep 2006 17:30:24 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/1144237</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1144237</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Mon, 25 Sep 2006 17:30:24 GMT</pubDate></item><item><title><![CDATA[Reply to was brauch ich?  Timer? on Mon, 25 Sep 2006 20:44:00 GMT]]></title><description><![CDATA[<p>vielleicht hilft Dir dies <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-160005-and-highlight-is-.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-160005-and-highlight-is-.html</a> schon mal weiter</p>
<p>Gruß<br />
Werner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1144333</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1144333</guid><dc:creator><![CDATA[Werner Salomon]]></dc:creator><pubDate>Mon, 25 Sep 2006 20:44:00 GMT</pubDate></item></channel></rss>