<?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[[C++]Edit-Box wird nicht ausgelesen &#x2F; Grafik wird nicht gezeichnet]]></title><description><![CDATA[<p>Hm... es ist zwar vieleicht etwas viel verlangt, das ihr den Quelltext auf Fehler untersucht, aber ich bin föllig ratlos. Der Conpiler gibt keinen Fehler aus trotzdem funktionierts nicht. Gut, das allein ist keine Seltenheit. <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="😉"
    /><br />
Uch vermute mal, dass der Fehler irgentwo in der Message-Prozedur liegt, aber ich post mal lieber den ganzen Quelltext.</p>
<pre><code>#include &lt;windows.h&gt;

#include &quot;units.h&quot;
#include &quot;spells.h&quot;
#include &quot;buildings.h&quot;

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

int DrawButtons(HWND hFound, char* pic_path, int x, int y);
int DrawBackground(HWND hwnd);

char szAppName[ ] = &quot;PathFinder&quot;;
char szFoundName[ ] = &quot;Found...&quot;;

int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)

{
    HWND hwnd;             
    MSG messages;          
    WNDCLASSEX wincl;      

    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szAppName;
    wincl.lpfnWndProc = WinProc;    
    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 = (HBRUSH) 19;

    if (!RegisterClassEx (&amp;wincl))
        return 0;

    //Found-Window structs
    wincl.hbrBackground       = (HBRUSH) 19;
    wincl.hIcon               = NULL;
    wincl.lpfnWndProc         = FoundProc;
    wincl.lpszClassName       = szFoundName;

    if (!RegisterClassEx (&amp;wincl))
        return 0;

    hwnd = CreateWindowEx (
           0,                 
           szAppName,     
           &quot;PathFinder&quot;,      
           WS_OVERLAPPED | WS_SYSMENU, 
           380,      
           240,      
           450,                
           300,               
           HWND_DESKTOP,       
           NULL,               
           hThisInstance,     
           NULL                 
           );

    ShowWindow (hwnd, nFunsterStil); 

    while (GetMessage (&amp;messages, NULL, 0, 0))
    {
        TranslateMessage(&amp;messages);
        DispatchMessage(&amp;messages);
    }

    return messages.wParam;
}

LRESULT CALLBACK WinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    HWND hSearch;
    HWND hEnter;
    HWND hFound;

    switch (message)             
    {
        case WM_COMMAND:
        {

            if (lParam == (LPARAM)hEnter)
            {

                if (HIWORD(wParam) == BN_CLICKED)
                {
                    char* szSearch;
                    int Ergebniss = 0;

                    int iLength;

                    iLength = GetWindowTextLength(hSearch);

                    GetWindowText(hSearch, szSearch, iLength+1);

                    Ergebniss = unit_search(szSearch);

                    if(Ergebniss != 0)
                    {             
                         MessageBox (NULL, &quot;Gefunden&quot;  , &quot;Info&quot;, MB_ICONINFORMATION);
                    }
                    else
                    {
                        MessageBox (NULL, &quot;Nicht gefunden :-( &quot;  , &quot;Info&quot;, MB_ICONINFORMATION);
                    }        
                    free(szSearch);
                }
            }        
            break;
        }

        case WM_CREATE:
        {
            DrawBackground(hwnd);

            //Create the Inputbox
            char* szSearch = NULL;

            hSearch = CreateWindowEx(WS_EX_CLIENTEDGE,
                                   &quot;edit&quot;,
                                   szSearch,    // &lt;- das ist der Inhalt der Editfelds
                                   WS_CHILD | WS_VISIBLE | ES_MULTILINE,
                                   35, 40, 120, 22,
                                   hwnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);
            free(szSearch);

            //Create the Enter-Button                       
            hEnter = CreateWindow(  &quot;button&quot;,
                                  &quot;Search!&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  60, 80, 70, 22,
                                  hwnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);

            //Create the Found-Window
            hFound = CreateWindow(  szFoundName,
                                 NULL,
                                 WS_CHILD | WS_VISIBLE | WS_DLGFRAME | WS_VSCROLL |
                                 ES_AUTOVSCROLL,
                                 200,
                                 5,
                                 230,
                                 248,
                                 hwnd,
                                 NULL,
                                 ((LPCREATESTRUCT) lParam)-&gt;hInstance,
                                 NULL);

            break;
        }
        case WM_SIZE:
        {
            DrawBackground(hwnd);
            break;
        }                
        case WM_DESTROY:
            PostQuitMessage (0);       
            break;
        default:                  
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}

//Found-Window
LRESULT CALLBACK FoundProc (HWND hFound, UINT message, WPARAM wParam, LPARAM lParam)
{    
    switch (message)             
    {
        case WM_CREATE:
        {
            DrawButtons(hFound, &quot;Human.bmp&quot;, 250, 50);
            break;
        }    
        case WM_DESTROY:
            PostQuitMessage (0);       
            break;
        default:                  
            return DefWindowProc (hFound, message, wParam, lParam);
    }
}

//Draws the buttons in the Scroll-Window
int DrawButtons(HWND hFound, char* pic_path, int x, int y)
{
    HANDLE hButton = LoadImage(NULL,pic_path,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
    HDC hdc = GetWindowDC(hFound);
    HDC hdc_ram = CreateCompatibleDC(NULL);
    SelectObject(hdc_ram, hButton);
    BitBlt(hdc, y, x, 30, 30, hdc_ram, 0, 0, SRCCOPY);

    return 0;
}

//Draws the background in the Main-Window
int DrawBackground(HWND hwnd)
{
    HANDLE hbitmap = LoadImage(NULL,&quot;GFX\\Background_wc3.bmp&quot;,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
    HDC hdc = GetWindowDC(hwnd);
    HDC hdc_ram = CreateCompatibleDC(NULL);
    SelectObject(hdc_ram, hbitmap);
    BitBlt(hdc, 0, 30, 400, 280, hdc_ram, 0, 0, SRCCOPY);

    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/91048/c-edit-box-wird-nicht-ausgelesen-grafik-wird-nicht-gezeichnet</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 04:52:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/91048.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Nov 2004 15:22:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [C++]Edit-Box wird nicht ausgelesen &#x2F; Grafik wird nicht gezeichnet on Thu, 04 Nov 2004 15:22:54 GMT]]></title><description><![CDATA[<p>Hm... es ist zwar vieleicht etwas viel verlangt, das ihr den Quelltext auf Fehler untersucht, aber ich bin föllig ratlos. Der Conpiler gibt keinen Fehler aus trotzdem funktionierts nicht. Gut, das allein ist keine Seltenheit. <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="😉"
    /><br />
Uch vermute mal, dass der Fehler irgentwo in der Message-Prozedur liegt, aber ich post mal lieber den ganzen Quelltext.</p>
<pre><code>#include &lt;windows.h&gt;

#include &quot;units.h&quot;
#include &quot;spells.h&quot;
#include &quot;buildings.h&quot;

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

int DrawButtons(HWND hFound, char* pic_path, int x, int y);
int DrawBackground(HWND hwnd);

char szAppName[ ] = &quot;PathFinder&quot;;
char szFoundName[ ] = &quot;Found...&quot;;

int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)

{
    HWND hwnd;             
    MSG messages;          
    WNDCLASSEX wincl;      

    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szAppName;
    wincl.lpfnWndProc = WinProc;    
    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 = (HBRUSH) 19;

    if (!RegisterClassEx (&amp;wincl))
        return 0;

    //Found-Window structs
    wincl.hbrBackground       = (HBRUSH) 19;
    wincl.hIcon               = NULL;
    wincl.lpfnWndProc         = FoundProc;
    wincl.lpszClassName       = szFoundName;

    if (!RegisterClassEx (&amp;wincl))
        return 0;

    hwnd = CreateWindowEx (
           0,                 
           szAppName,     
           &quot;PathFinder&quot;,      
           WS_OVERLAPPED | WS_SYSMENU, 
           380,      
           240,      
           450,                
           300,               
           HWND_DESKTOP,       
           NULL,               
           hThisInstance,     
           NULL                 
           );

    ShowWindow (hwnd, nFunsterStil); 

    while (GetMessage (&amp;messages, NULL, 0, 0))
    {
        TranslateMessage(&amp;messages);
        DispatchMessage(&amp;messages);
    }

    return messages.wParam;
}

LRESULT CALLBACK WinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    HWND hSearch;
    HWND hEnter;
    HWND hFound;

    switch (message)             
    {
        case WM_COMMAND:
        {

            if (lParam == (LPARAM)hEnter)
            {

                if (HIWORD(wParam) == BN_CLICKED)
                {
                    char* szSearch;
                    int Ergebniss = 0;

                    int iLength;

                    iLength = GetWindowTextLength(hSearch);

                    GetWindowText(hSearch, szSearch, iLength+1);

                    Ergebniss = unit_search(szSearch);

                    if(Ergebniss != 0)
                    {             
                         MessageBox (NULL, &quot;Gefunden&quot;  , &quot;Info&quot;, MB_ICONINFORMATION);
                    }
                    else
                    {
                        MessageBox (NULL, &quot;Nicht gefunden :-( &quot;  , &quot;Info&quot;, MB_ICONINFORMATION);
                    }        
                    free(szSearch);
                }
            }        
            break;
        }

        case WM_CREATE:
        {
            DrawBackground(hwnd);

            //Create the Inputbox
            char* szSearch = NULL;

            hSearch = CreateWindowEx(WS_EX_CLIENTEDGE,
                                   &quot;edit&quot;,
                                   szSearch,    // &lt;- das ist der Inhalt der Editfelds
                                   WS_CHILD | WS_VISIBLE | ES_MULTILINE,
                                   35, 40, 120, 22,
                                   hwnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);
            free(szSearch);

            //Create the Enter-Button                       
            hEnter = CreateWindow(  &quot;button&quot;,
                                  &quot;Search!&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  60, 80, 70, 22,
                                  hwnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);

            //Create the Found-Window
            hFound = CreateWindow(  szFoundName,
                                 NULL,
                                 WS_CHILD | WS_VISIBLE | WS_DLGFRAME | WS_VSCROLL |
                                 ES_AUTOVSCROLL,
                                 200,
                                 5,
                                 230,
                                 248,
                                 hwnd,
                                 NULL,
                                 ((LPCREATESTRUCT) lParam)-&gt;hInstance,
                                 NULL);

            break;
        }
        case WM_SIZE:
        {
            DrawBackground(hwnd);
            break;
        }                
        case WM_DESTROY:
            PostQuitMessage (0);       
            break;
        default:                  
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}

//Found-Window
LRESULT CALLBACK FoundProc (HWND hFound, UINT message, WPARAM wParam, LPARAM lParam)
{    
    switch (message)             
    {
        case WM_CREATE:
        {
            DrawButtons(hFound, &quot;Human.bmp&quot;, 250, 50);
            break;
        }    
        case WM_DESTROY:
            PostQuitMessage (0);       
            break;
        default:                  
            return DefWindowProc (hFound, message, wParam, lParam);
    }
}

//Draws the buttons in the Scroll-Window
int DrawButtons(HWND hFound, char* pic_path, int x, int y)
{
    HANDLE hButton = LoadImage(NULL,pic_path,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
    HDC hdc = GetWindowDC(hFound);
    HDC hdc_ram = CreateCompatibleDC(NULL);
    SelectObject(hdc_ram, hButton);
    BitBlt(hdc, y, x, 30, 30, hdc_ram, 0, 0, SRCCOPY);

    return 0;
}

//Draws the background in the Main-Window
int DrawBackground(HWND hwnd)
{
    HANDLE hbitmap = LoadImage(NULL,&quot;GFX\\Background_wc3.bmp&quot;,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
    HDC hdc = GetWindowDC(hwnd);
    HDC hdc_ram = CreateCompatibleDC(NULL);
    SelectObject(hdc_ram, hbitmap);
    BitBlt(hdc, 0, 30, 400, 280, hdc_ram, 0, 0, SRCCOPY);

    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/644651</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/644651</guid><dc:creator><![CDATA[DarkLord]]></dc:creator><pubDate>Thu, 04 Nov 2004 15:22:54 GMT</pubDate></item><item><title><![CDATA[Reply to [C++]Edit-Box wird nicht ausgelesen &#x2F; Grafik wird nicht gezeichnet on Thu, 04 Nov 2004 15:25:38 GMT]]></title><description><![CDATA[<p>1. GetLastError() und rückgabewerte sind deine freunde. <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="😉"
    /><br />
2. die hwnd in der msgproc sollten static sein</p>
<pre><code class="language-cpp">LRESULT CALLBACK WinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    static HWND hSearch;
    static HWND hEnter;
    static HWND hFound;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/644652</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/644652</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Thu, 04 Nov 2004 15:25:38 GMT</pubDate></item><item><title><![CDATA[Reply to [C++]Edit-Box wird nicht ausgelesen &#x2F; Grafik wird nicht gezeichnet on Thu, 04 Nov 2004 18:42:15 GMT]]></title><description><![CDATA[<p>Hm.. danke ich werds gleich mal ausprobieren.<br />
Und den Trick mit dem LastGetError() kannte ich garnicht, danke für den Tip. <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="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/644818</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/644818</guid><dc:creator><![CDATA[DarkLord]]></dc:creator><pubDate>Thu, 04 Nov 2004 18:42:15 GMT</pubDate></item></channel></rss>