<?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[Probleme mit Timer]]></title><description><![CDATA[<p>Wieso bekommt mein Fenster keine WM_TIMER Nachricht?</p>
<pre><code class="language-cpp">LRESULT CALLBACK TimeProcedure (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    HWND hStart, hZeroTimer;
    static HWND edTimer1;
    static float time = 0.0f;
    static bool fTimer = false;
    static UINT Timer;
    char temp[10];

    switch (message)                  /* handle the messages */
    {
        case WM_CREATE:
        {
            hStart = CreateWindow (&quot;button&quot;, &quot;Start / Stopp&quot;, WS_CHILD | WS_VISIBLE,
                                       60, 170, 120, 50, hWnd, (HMENU) BU_STARTTIME, 
                                       ((LPCREATESTRUCT) lParam) -&gt;hInstance, NULL);

            hZeroTimer = CreateWindow (&quot;button&quot;, &quot;Nullstellung&quot;, WS_CHILD | WS_VISIBLE,
                                       215, 170, 120, 50, hWnd, (HMENU) BU_ZEROTIME, 
                                       ((LPCREATESTRUCT) lParam) -&gt;hInstance, NULL);

            edTimer1 = CreateWindow (&quot;edit&quot;, &quot;&quot;, WS_CHILD | WS_VISIBLE | ES_RIGHT,
                                       60, 30, 120, 50, hWnd, NULL, 
                                       ((LPCREATESTRUCT) lParam) -&gt;hInstance, NULL);

            break;
        }
        case WM_COMMAND:
        {
            switch (LOWORD(wParam))
            {
                case BU_ZEROTIME:
                {
                    break;
                }
                case BU_STARTTIME:
                {
                    if (fTimer)
                    {
                        KillTimer (hWnd, Timer);
                        time = 0.0f;
                        fTimer = false;
                        SendMessage (hWnd, WM_TIMER, 0, 0);
                    }
                    else
                    {
                        SetTimer (hWnd, 1, 100, NULL);
                        fTimer = true;
                    }
                    break;
                }
                default:
                    break;
            }
            break;
        }
        case WM_TIMER:
        {
            time += 0.1f;
            sprintf (temp, &quot;%.2f&quot;, time);
            SetWindowText (edTimer1, temp);
            UpdateWindow (edTimer1);
            break;
        }
        case WM_DESTROY:
            PostQuitMessage (0);       
            break;
        default:                      
            return DefWindowProc (hWnd, message, wParam, lParam);
    }
    return 0;
}
</code></pre>
<p>Hab schon viel rumprobiert, bin aber auf keine Lösung gestoßen.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/90947/probleme-mit-timer</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 04:53:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/90947.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Nov 2004 17:50:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 17:50:24 GMT]]></title><description><![CDATA[<p>Wieso bekommt mein Fenster keine WM_TIMER Nachricht?</p>
<pre><code class="language-cpp">LRESULT CALLBACK TimeProcedure (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    HWND hStart, hZeroTimer;
    static HWND edTimer1;
    static float time = 0.0f;
    static bool fTimer = false;
    static UINT Timer;
    char temp[10];

    switch (message)                  /* handle the messages */
    {
        case WM_CREATE:
        {
            hStart = CreateWindow (&quot;button&quot;, &quot;Start / Stopp&quot;, WS_CHILD | WS_VISIBLE,
                                       60, 170, 120, 50, hWnd, (HMENU) BU_STARTTIME, 
                                       ((LPCREATESTRUCT) lParam) -&gt;hInstance, NULL);

            hZeroTimer = CreateWindow (&quot;button&quot;, &quot;Nullstellung&quot;, WS_CHILD | WS_VISIBLE,
                                       215, 170, 120, 50, hWnd, (HMENU) BU_ZEROTIME, 
                                       ((LPCREATESTRUCT) lParam) -&gt;hInstance, NULL);

            edTimer1 = CreateWindow (&quot;edit&quot;, &quot;&quot;, WS_CHILD | WS_VISIBLE | ES_RIGHT,
                                       60, 30, 120, 50, hWnd, NULL, 
                                       ((LPCREATESTRUCT) lParam) -&gt;hInstance, NULL);

            break;
        }
        case WM_COMMAND:
        {
            switch (LOWORD(wParam))
            {
                case BU_ZEROTIME:
                {
                    break;
                }
                case BU_STARTTIME:
                {
                    if (fTimer)
                    {
                        KillTimer (hWnd, Timer);
                        time = 0.0f;
                        fTimer = false;
                        SendMessage (hWnd, WM_TIMER, 0, 0);
                    }
                    else
                    {
                        SetTimer (hWnd, 1, 100, NULL);
                        fTimer = true;
                    }
                    break;
                }
                default:
                    break;
            }
            break;
        }
        case WM_TIMER:
        {
            time += 0.1f;
            sprintf (temp, &quot;%.2f&quot;, time);
            SetWindowText (edTimer1, temp);
            UpdateWindow (edTimer1);
            break;
        }
        case WM_DESTROY:
            PostQuitMessage (0);       
            break;
        default:                      
            return DefWindowProc (hWnd, message, wParam, lParam);
    }
    return 0;
}
</code></pre>
<p>Hab schon viel rumprobiert, bin aber auf keine Lösung gestoßen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/643854</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/643854</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Wed, 03 Nov 2004 17:50:24 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 18:20:04 GMT]]></title><description><![CDATA[<p>- Was hier stand hat hoffentlich niemand gelesen -</p>
]]></description><link>https://www.c-plusplus.net/forum/post/643896</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/643896</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Wed, 03 Nov 2004 18:20:04 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 18:37:20 GMT]]></title><description><![CDATA[<p>Schon mal GetLastError nach <em>SetTimer</em> aufgreufen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/643921</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/643921</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Wed, 03 Nov 2004 18:37:20 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 18:49:57 GMT]]></title><description><![CDATA[<p>Ja, Ergebnis: ERROR_ACCESS_DENIED<br />
Kann ich mir nix drunter vorstellen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/643935</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/643935</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Wed, 03 Nov 2004 18:49:57 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 18:57:27 GMT]]></title><description><![CDATA[<p>ist deine timer id korrekt ?<br />
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/usingtimers.asp" rel="nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/usingtimers.asp</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/643945</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/643945</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Wed, 03 Nov 2004 18:57:27 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 19:00:02 GMT]]></title><description><![CDATA[<p>GetLastError() aber nur Aufrufen, wenn SetTimer fehlgeschlagen ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/643948</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/643948</guid><dc:creator><![CDATA[6]]></dc:creator><pubDate>Wed, 03 Nov 2004 19:00:02 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 19:38:37 GMT]]></title><description><![CDATA[<p>ist fehlgeschlagen! Es wird 0 zurückgegeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/643986</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/643986</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Wed, 03 Nov 2004 19:38:37 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 20:02:56 GMT]]></title><description><![CDATA[<p>Und wenn du eine andere ID als 1 nimmst?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/643998</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/643998</guid><dc:creator><![CDATA[+1]]></dc:creator><pubDate>Wed, 03 Nov 2004 20:02:56 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 20:24:40 GMT]]></title><description><![CDATA[<p>Nein. Kanns daran liegen, dass das Fenster selbst ein Child ist?</p>
<pre><code class="language-cpp">WNDCLASSEX wincl;

            wincl.hInstance = ((LPCREATESTRUCT) lParam) -&gt;hInstance;
            wincl.lpszClassName = szTimeName;
            wincl.lpfnWndProc = TimeProcedure;
            wincl.style = CS_DBLCLKS;
            wincl.cbSize = sizeof (WNDCLASSEX);

            wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
            wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
            wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
            wincl.lpszMenuName = NULL;
            wincl.cbClsExtra = 0;
            wincl.cbWndExtra = 0;
            wincl.hbrBackground = CreateSolidBrush (RGB (128, 128, 128));

            RegisterClassEx (&amp;wincl);

            lTime = CreateWindow (szTimeName, &quot;&quot;, WS_CHILD, 
                                   400, 305, 390, 235, hWnd, NULL, 
                                   ((LPCREATESTRUCT) lParam) -&gt;hInstance, NULL);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/644014</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/644014</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Wed, 03 Nov 2004 20:24:40 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 20:26:23 GMT]]></title><description><![CDATA[<p>Kannst du nicht den ganzen Quelltext geben so das wir es kompilieren können?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/644017</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/644017</guid><dc:creator><![CDATA[childd]]></dc:creator><pubDate>Wed, 03 Nov 2004 20:26:23 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 23:12:14 GMT]]></title><description><![CDATA[<p>--- Aufgrund des Posts weiter unten gelöscht ---</p>
]]></description><link>https://www.c-plusplus.net/forum/post/644055</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/644055</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Wed, 03 Nov 2004 23:12:14 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 21:24:40 GMT]]></title><description><![CDATA[<p>Normalerweise postet man ein Minimalbeispiel das den Fehler zeigt.</p>
<p>Und das tolle daran ist, das man den Fehler dann auch meistens selbst findet, wenn man den Code so weit eingrenzen kann. Nimm ALLES raus was nichts mit dem Fehler zu tun hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/644063</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/644063</guid><dc:creator><![CDATA[~~~~~~~~]]></dc:creator><pubDate>Wed, 03 Nov 2004 21:24:40 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Wed, 03 Nov 2004 23:25:44 GMT]]></title><description><![CDATA[<p>hmm, Prob gelöst: das Programm musste das DefWndProc für WM_PAINT aufrufen.<br />
Darauf muss man erst mal kommen. Danke an alle für die Hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/644154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/644154</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Wed, 03 Nov 2004 23:25:44 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Thu, 04 Nov 2004 11:25:10 GMT]]></title><description><![CDATA[<p>Ok, das wars doch nicht. Jedenfalls nicht ganz. Anscheinend ergibt sich ein ähnliches Problem, wenn mehr als ein Child im Haupfenster angezeigt werden. Und zwar wird das Edit dann trotz wiederholter Anwendung von UpdateWindow nicht aktualisiert. Soll ich Code posten? Wird etwas umfangreich, da man nicht mehr viel entfernen kann.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/644417</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/644417</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Thu, 04 Nov 2004 11:25:10 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Timer on Thu, 04 Nov 2004 20:17:40 GMT]]></title><description><![CDATA[<p>Wenn du es nicht schaffst das Problem / Programm zu minimalisieren, weil dann evtl. der Fehler gar nicht mehr auftritt, dann solltest versuchen Stück für Stück deinen Code wieder reinzunehmen, um zu testen, was dieses Verhalten verursacht. Wenn alles nichts mehr hilft, kannst du ja einen so stark wie dir möglich vereinfachten Code posten (dürfte dann ja eigentlich auch nicht allzu schrecklich lang sein) <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/644919</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/644919</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Thu, 04 Nov 2004 20:17:40 GMT</pubDate></item></channel></rss>