<?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[Meine Steuerelemente funktionieren nicht, wieso nicht?]]></title><description><![CDATA[<p>hallo ich habe mir mal eine einfache anwendung geschreiben die ein fenster erstellt nun möchte ich mich langsam mal darum bemühen mich mir Steuerelementen vertraut zu machen. also hier er einmal mein quelltext:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

#include &quot;MW_Trainer.h&quot;
#pragma hdrstop
#pragma argsused

HINSTANCE hInst;
HWND hWnd;
WNDCLASS wc;
HDC hDC;
MSG msg;

HANDLE hProc;
HWND mw;
DWORD r, w;
DWORD procID;

unsigned int _mw_time = 0x100579C;
int _b_time = 0;

char name[] = &quot;szMW_Trainer&quot;;

void _CreateWin( char *title, int width, int height );
void _KillWin();

LRESULT CALLBACK WinProc( HWND, UINT, WPARAM, LPARAM );

WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
                int nCmdShow) {

    _CreateWin( &quot;MineSweeper Trainer&quot;, 400, 300 );

    while( GetMessage( &amp;msg, 0, 0, 0 ) ) {

        TranslateMessage( &amp;msg);
        DispatchMessage( &amp;msg );
    }
    _KillWin();
    return( msg.wParam);
}

void _CreateWin( char *title, int width, int height ) {

    wc.hInstance = hInst;
    wc.lpfnWndProc = WinProc;
    wc.lpszClassName = name;
    wc.lpszMenuName = 0;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hIcon = LoadIcon( 0, IDI_APPLICATION );
    wc.hCursor = LoadCursor( 0, IDC_ARROW );
    wc.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH );
    wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;

    if( !( RegisterClass( &amp;wc ) ) ) {

        MessageBox( 0, &quot; Couldn't register this Window by Windows.&quot;,
                    &quot; Shutdown error&quot;, MB_OK | MB_ICONEXCLAMATION );
        return;
    }

    hWnd = CreateWindow( name, title,
                         WS_OVERLAPPED | WS_SYSMENU,
                         400, 300, width, height,
                         0,
                         0,
                         hWnd,
                         0 );

    ShowWindow( hWnd, SW_SHOW );
    UpdateWindow( hWnd );
}

void _KillWin() {

    if( hDC ) {

        ReleaseDC( hWnd, hDC );
    }
    hDC = 0;

    if( hWnd ) {

        DestroyWindow( hWnd );
    }
    hWnd = 0;

    if( hInst ) {

        UnregisterClass( name, hInst );
    }
    hInst = 0;
}

LRESULT CALLBACK WinProc( HWND hWnd, UINT message, WPARAM wParam,
                          LPARAM lParam ) {

    static HWND tfield_1;
    char buffer[128];
    switch( message ) {

        case WM_CREATE: {

            tfield_1 = CreateWindow( &quot;listbox&quot;, 0, WS_CHILD | WS_VISIBLE,
	                      10, 10, 200, 120, hWnd, (HMENU)ID_TFIELD_001, hInst,
                          0 ) ;

            CreateWindow( &quot;button&quot;, &quot;mein Button&quot;,
                          WS_CHILD | WS_VISIBLE | WS_BORDER,
	                      10, 135, 100, 30, hWnd, (HMENU)ID_BUTTON_001, hInst,
                          0 );

            SendMessage( tfield_1, WM_SETTEXT, 0, (long)&quot;Hallo hallo&quot; );

            return 0;
        }

        case WM_SIZE: {

            return 0;
        }

        case WM_COMMAND: {

            switch( HIWORD( wParam ) ) {

                case BN_CLICKED: {

                    switch( LOWORD( wParam ) ) {

                        case ID_BUTTON_001: {

                            MessageBox( 0, &quot;klick&quot;, &quot;klick&quot;, MB_OK );
                            break;
                        }
                    }
                }

                case ID_TFIELD_001: {

                    SendMessage( tfield_1, WM_GETTEXT, sizeof( buffer ),
                                 (long)buffer );
                    MessageBox( 0, buffer, &quot;lol&quot;, MB_OK );
                    break;
                }
            }
            return 0;
        }

        case WM_PAINT: {

            return 0;
        }

        case WM_DESTROY: {

            PostQuitMessage( 0 );
            return 0;
        }
    }
    return( DefWindowProc( hWnd, message, wParam, lParam ) );
}
</code></pre>
<p>die ID's sind in dem header. eigentlich muesste nun Text in der liste stehen und beim klicken des buttons ne MSGBOX aufgehen oder?... wieso funktioniert des net?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/166042/meine-steuerelemente-funktionieren-nicht-wieso-nicht</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 01:50:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/166042.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 25 Nov 2006 16:03:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Meine Steuerelemente funktionieren nicht, wieso nicht? on Sat, 25 Nov 2006 16:19:56 GMT]]></title><description><![CDATA[<p>hallo ich habe mir mal eine einfache anwendung geschreiben die ein fenster erstellt nun möchte ich mich langsam mal darum bemühen mich mir Steuerelementen vertraut zu machen. also hier er einmal mein quelltext:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

#include &quot;MW_Trainer.h&quot;
#pragma hdrstop
#pragma argsused

HINSTANCE hInst;
HWND hWnd;
WNDCLASS wc;
HDC hDC;
MSG msg;

HANDLE hProc;
HWND mw;
DWORD r, w;
DWORD procID;

unsigned int _mw_time = 0x100579C;
int _b_time = 0;

char name[] = &quot;szMW_Trainer&quot;;

void _CreateWin( char *title, int width, int height );
void _KillWin();

LRESULT CALLBACK WinProc( HWND, UINT, WPARAM, LPARAM );

WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
                int nCmdShow) {

    _CreateWin( &quot;MineSweeper Trainer&quot;, 400, 300 );

    while( GetMessage( &amp;msg, 0, 0, 0 ) ) {

        TranslateMessage( &amp;msg);
        DispatchMessage( &amp;msg );
    }
    _KillWin();
    return( msg.wParam);
}

void _CreateWin( char *title, int width, int height ) {

    wc.hInstance = hInst;
    wc.lpfnWndProc = WinProc;
    wc.lpszClassName = name;
    wc.lpszMenuName = 0;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hIcon = LoadIcon( 0, IDI_APPLICATION );
    wc.hCursor = LoadCursor( 0, IDC_ARROW );
    wc.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH );
    wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;

    if( !( RegisterClass( &amp;wc ) ) ) {

        MessageBox( 0, &quot; Couldn't register this Window by Windows.&quot;,
                    &quot; Shutdown error&quot;, MB_OK | MB_ICONEXCLAMATION );
        return;
    }

    hWnd = CreateWindow( name, title,
                         WS_OVERLAPPED | WS_SYSMENU,
                         400, 300, width, height,
                         0,
                         0,
                         hWnd,
                         0 );

    ShowWindow( hWnd, SW_SHOW );
    UpdateWindow( hWnd );
}

void _KillWin() {

    if( hDC ) {

        ReleaseDC( hWnd, hDC );
    }
    hDC = 0;

    if( hWnd ) {

        DestroyWindow( hWnd );
    }
    hWnd = 0;

    if( hInst ) {

        UnregisterClass( name, hInst );
    }
    hInst = 0;
}

LRESULT CALLBACK WinProc( HWND hWnd, UINT message, WPARAM wParam,
                          LPARAM lParam ) {

    static HWND tfield_1;
    char buffer[128];
    switch( message ) {

        case WM_CREATE: {

            tfield_1 = CreateWindow( &quot;listbox&quot;, 0, WS_CHILD | WS_VISIBLE,
	                      10, 10, 200, 120, hWnd, (HMENU)ID_TFIELD_001, hInst,
                          0 ) ;

            CreateWindow( &quot;button&quot;, &quot;mein Button&quot;,
                          WS_CHILD | WS_VISIBLE | WS_BORDER,
	                      10, 135, 100, 30, hWnd, (HMENU)ID_BUTTON_001, hInst,
                          0 );

            SendMessage( tfield_1, WM_SETTEXT, 0, (long)&quot;Hallo hallo&quot; );

            return 0;
        }

        case WM_SIZE: {

            return 0;
        }

        case WM_COMMAND: {

            switch( HIWORD( wParam ) ) {

                case BN_CLICKED: {

                    switch( LOWORD( wParam ) ) {

                        case ID_BUTTON_001: {

                            MessageBox( 0, &quot;klick&quot;, &quot;klick&quot;, MB_OK );
                            break;
                        }
                    }
                }

                case ID_TFIELD_001: {

                    SendMessage( tfield_1, WM_GETTEXT, sizeof( buffer ),
                                 (long)buffer );
                    MessageBox( 0, buffer, &quot;lol&quot;, MB_OK );
                    break;
                }
            }
            return 0;
        }

        case WM_PAINT: {

            return 0;
        }

        case WM_DESTROY: {

            PostQuitMessage( 0 );
            return 0;
        }
    }
    return( DefWindowProc( hWnd, message, wParam, lParam ) );
}
</code></pre>
<p>die ID's sind in dem header. eigentlich muesste nun Text in der liste stehen und beim klicken des buttons ne MSGBOX aufgehen oder?... wieso funktioniert des net?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181294</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181294</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Sat, 25 Nov 2006 16:19:56 GMT</pubDate></item><item><title><![CDATA[Reply to Meine Steuerelemente funktionieren nicht, wieso nicht? on Sat, 25 Nov 2006 16:55:34 GMT]]></title><description><![CDATA[<p>Bei deinem switch für HIWORD( wParam ) hast du einmal ein BN_CLICKED und einmal ein ID_TFIELD_001 - es kann natürlich nur eines davon richtig sein (welche das ist, findest du <a href="http://msdn2.microsoft.com/en-us/library/ms647591.aspx" rel="nofollow">hier</a>)</p>
<p>Und bei einer listbox kannst du nicht einfach mit WM_SETTEXT und WM_GETTEXT arbeiten. Näheres findest du <a href="http://msdn2.microsoft.com/en-us/library/ms671394.aspx" rel="nofollow">hier</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181338</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181338</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sat, 25 Nov 2006 16:55:34 GMT</pubDate></item><item><title><![CDATA[Reply to Meine Steuerelemente funktionieren nicht, wieso nicht? on Sun, 26 Nov 2006 12:33:09 GMT]]></title><description><![CDATA[<p>sorry, aba ich weiss einfach net weiter wie ich es modifizieren muss damit es geht... hmmm??? koenntet ihr mir net mal an meinem code zeigen was geaendert werden muss?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181638</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181638</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Sun, 26 Nov 2006 12:33:09 GMT</pubDate></item><item><title><![CDATA[Reply to Meine Steuerelemente funktionieren nicht, wieso nicht? on Sun, 26 Nov 2006 12:57:42 GMT]]></title><description><![CDATA[<p>Hier findest du ein Beispiel: <a href="http://msdn2.microsoft.com/en-us/library/ms671395.aspx#simple_listbox" rel="nofollow">http://msdn2.microsoft.com/en-us/library/ms671395.aspx#simple_listbox</a><br />
Wenn du keinen Dialog hast, sondern ein normales Fenster kommt der Code, der dort bei WM_INITDIALOG steht bei dir in den WM_CREATE-Zweig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181657</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181657</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sun, 26 Nov 2006 12:57:42 GMT</pubDate></item><item><title><![CDATA[Reply to Meine Steuerelemente funktionieren nicht, wieso nicht? on Sun, 26 Nov 2006 18:19:32 GMT]]></title><description><![CDATA[<p>hm, also soweit funktioniert es das wenn ich mit<br />
SendMessage( ..., LB_ADDSTRING, ... ) was in die liste schreibe... doch wenn ich mein button klicke passiert nicht mit SendM. erst wenn ich das fenster bewege wird der text angezeigt.. hmmm auch InvalidateRect(); brachte nichts. also der auftrg wird an die lb gegeben nur wird erst angezeigt wenn ich das fenster bewege ooder mit der maus in die lb klicke. weitergehen sollte doch dann die msgbox aufgehen tut sie aber auch nicht also irgend was ist da noch nicht richtig:</p>
<pre><code class="language-cpp">LRESULT CALLBACK WinProc( HWND hWnd, UINT message, WPARAM wParam,
                          LPARAM lParam ) {

    static HWND tfield_1;
    char buffer[128];

    switch( message ) {

        case WM_CREATE: {

            tfield_1 = CreateWindow( &quot;listbox&quot;, 0, WS_CHILD | WS_VISIBLE,
	                      10, 10, 200, 120, hWnd, (HMENU)ID_TFIELD_001, hInst,
                          0 ) ;

            CreateWindow( &quot;button&quot;, &quot;mein Button&quot;,
                          WS_CHILD | WS_VISIBLE | WS_BORDER | BS_PUSHBUTTON,
	                      10, 135, 100, 30, hWnd, (HMENU)ID_BUTTON_001, hInst,
                          0 );

            SendMessage( tfield_1, LB_ADDSTRING, 0, (long) &quot;Test Text hier.1&quot; );

            return 0;
        }

        case WM_SIZE: {

            return 0;
        }

        case WM_COMMAND: {

            switch( LOWORD( wParam ) ) {

                case ID_TFIELD_001: {

                    SendMessage( tfield_1, WM_GETTEXT, sizeof( buffer ),
                                 (long)buffer );
                    break;
                }

                case ID_BUTTON_001: {

                    switch( HIWORD( wParam ) ) {

                        case BN_CLICKED: {

                            SendMessage( tfield_1, LB_ADDSTRING, 0,
                                         (long)&quot;Hallo hallo&quot; );
                            break;
                        }
                    }
                }
            }
[...]
</code></pre>
<p>woran liegts?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181833</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181833</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Sun, 26 Nov 2006 18:19:32 GMT</pubDate></item><item><title><![CDATA[Reply to Meine Steuerelemente funktionieren nicht, wieso nicht? on Sun, 26 Nov 2006 18:54:30 GMT]]></title><description><![CDATA[<p>T0bi schrieb:</p>
<blockquote>
<p>wenn ich mein button klicke passiert nicht mit SendM. erst wenn ich das fenster bewege wird der text angezeigt.. hmmm auch InvalidateRect(); brachte nichts. also der auftrg wird an die lb gegeben nur wird erst angezeigt wenn ich das fenster bewege ooder mit der maus in die lb klicke.</p>
</blockquote>
<p>Also bei mir funktioniert dein Code (soweit du ihn gepostet hast) ohne Probleme.</p>
<p>T0bi schrieb:</p>
<blockquote>
<p>weitergehen sollte doch dann die msgbox aufgehen tut sie aber auch nicht also irgend was ist da noch nicht richtig:</p>
<pre><code class="language-cpp">SendMessage( tfield_1, WM_GETTEXT, sizeof( buffer ), (long)buffer );
</code></pre>
</blockquote>
<p>Durch SendMessage wird doch keine MessageBox erzeugt?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181853</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181853</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sun, 26 Nov 2006 18:54:30 GMT</pubDate></item><item><title><![CDATA[Reply to Meine Steuerelemente funktionieren nicht, wieso nicht? on Sun, 26 Nov 2006 19:16:42 GMT]]></title><description><![CDATA[<p>jo sry hab bei mir noch MessabeBox( 0, &quot;klick&quot;, &quot;klick&quot;, MB_OK&quot; ); stehen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> aber wieso geht das bei dir so einwandfrei -.-... bei mir wird alles nur sicht bar wenn ich mein window verscheibe, hmm.... oder muss ich noch includen ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181873</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181873</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Sun, 26 Nov 2006 19:16:42 GMT</pubDate></item><item><title><![CDATA[Reply to Meine Steuerelemente funktionieren nicht, wieso nicht? on Sun, 26 Nov 2006 19:21:53 GMT]]></title><description><![CDATA[<p>alles klar ich habs... da muss kein InvalidateRect hin sondern nen UpdateWindow() <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> alles klar ^^ funktioniert so weit, denke aba mal das ich mich bald wieder melden werde, so lass ich den thread noch offen xD ~i'll be back~<br />
danke fuer alles erst einmal</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181876</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181876</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Sun, 26 Nov 2006 19:21:53 GMT</pubDate></item><item><title><![CDATA[Reply to Meine Steuerelemente funktionieren nicht, wieso nicht? on Mon, 27 Nov 2006 01:41:01 GMT]]></title><description><![CDATA[<p>Sagmal <a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/12675">@T0bi</a>, in welche Klasse gehst du eigentlich ?</p>
<p>Kannst du eigentlich auch etwas selbstständig.... ?</p>
<p>Ich frage nur, da ich deine Fragen immer sehr 'hilfsbedürftig' und unkonkret formuliert finde...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181994</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181994</guid><dc:creator><![CDATA[Hm?!]]></dc:creator><pubDate>Mon, 27 Nov 2006 01:41:01 GMT</pubDate></item></channel></rss>