<?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[GDI und hwnd;]]></title><description><![CDATA[<p>Zuerst einmal mein code:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

#define LINIE      1

HWND bPixel;
/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = &quot;WindowsApp&quot;;

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

{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default color as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&amp;wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           &quot;Windows App&quot;,       /* Title Text */
           WS_OVERLAPPEDWINDOW, /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           544,                 /* The programs width */
           375,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nFunsterStil);

     bPixel      = CreateWindow(&quot;button&quot;, &quot;Pixel&quot;, WS_CHILD | WS_VISIBLE |
                               BS_DEFPUSHBUTTON, 310, 0, 80, 30,
                               hWnd, (HMENU)PIXEL, hInstance, NULL);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&amp;messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&amp;messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&amp;messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
}

/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)                  /* handle the messages */
    {            
         case WM_CLOSE:
            DestroyWindow(hwnd);
            return 0;
        case WM_PAINT:
            PAINTSTRUCT ps;
            HDC hdc;
            hdc = BeginPaint (hwnd, &amp;ps);
            SetTextColor( hdc, RGB( 255,   0,  0) );  // rot
            SetBkColor  ( hdc, RGB( 255, 255,  0) );  // gelb
            TextOut     ( hdc, 20, 20, &quot;Ich bin ein Fenster.&quot;, 20);
            EndPaint (hwnd, &amp;ps); 
            return 0;
        case WM_DESTROY:
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}
</code></pre>
<p>Dies war der versuch oben ein inputfeld hinzusetzen und unten mit der pixel malen zu können die dort hingesetzt werden wo sich halt die maus befindet (int X,Y;)</p>
<blockquote>
<p>Compiler: Default compiler<br />
Building Makefile: &quot;C:\Dev-Cpp\Makefile.win&quot;<br />
Executing make...<br />
make.exe -f &quot;C:\Dev-Cpp\Makefile.win&quot; all<br />
g++.exe -c main.cpp -o main.o -I&quot;C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include&quot; -I&quot;C:/Dev-Cpp/include/c++/3.4.2/backward&quot; -I&quot;C:/Dev-Cpp/include/c++/3.4.2/mingw32&quot; -I&quot;C:/Dev-Cpp/include/c++/3.4.2&quot; -I&quot;C:/Dev-Cpp/include&quot;</p>
<p>main.cpp: In function <code>int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)': main.cpp:63: error:</code>hWnd' undeclared (first use this function)<br />
main.cpp:63: error: (Each undeclared identifier is reported only once for each function it appears in.)<br />
main.cpp:63: error: <code>PIXEL' undeclared (first use this function) main.cpp:63: error:</code>hInstance' undeclared (first use this function)</p>
<p>make.exe: *** [main.o] Error 1</p>
<p>Execution terminated</p>
</blockquote>
<p>Ich wäre für eure hilfe dankbar</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/201903/gdi-und-hwnd</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 01:22:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/201903.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 05 Jan 2008 14:58:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GDI und hwnd; on Sat, 05 Jan 2008 14:58:23 GMT]]></title><description><![CDATA[<p>Zuerst einmal mein code:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

#define LINIE      1

HWND bPixel;
/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = &quot;WindowsApp&quot;;

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

{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default color as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&amp;wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           &quot;Windows App&quot;,       /* Title Text */
           WS_OVERLAPPEDWINDOW, /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           544,                 /* The programs width */
           375,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nFunsterStil);

     bPixel      = CreateWindow(&quot;button&quot;, &quot;Pixel&quot;, WS_CHILD | WS_VISIBLE |
                               BS_DEFPUSHBUTTON, 310, 0, 80, 30,
                               hWnd, (HMENU)PIXEL, hInstance, NULL);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&amp;messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&amp;messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&amp;messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
}

/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)                  /* handle the messages */
    {            
         case WM_CLOSE:
            DestroyWindow(hwnd);
            return 0;
        case WM_PAINT:
            PAINTSTRUCT ps;
            HDC hdc;
            hdc = BeginPaint (hwnd, &amp;ps);
            SetTextColor( hdc, RGB( 255,   0,  0) );  // rot
            SetBkColor  ( hdc, RGB( 255, 255,  0) );  // gelb
            TextOut     ( hdc, 20, 20, &quot;Ich bin ein Fenster.&quot;, 20);
            EndPaint (hwnd, &amp;ps); 
            return 0;
        case WM_DESTROY:
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}
</code></pre>
<p>Dies war der versuch oben ein inputfeld hinzusetzen und unten mit der pixel malen zu können die dort hingesetzt werden wo sich halt die maus befindet (int X,Y;)</p>
<blockquote>
<p>Compiler: Default compiler<br />
Building Makefile: &quot;C:\Dev-Cpp\Makefile.win&quot;<br />
Executing make...<br />
make.exe -f &quot;C:\Dev-Cpp\Makefile.win&quot; all<br />
g++.exe -c main.cpp -o main.o -I&quot;C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include&quot; -I&quot;C:/Dev-Cpp/include/c++/3.4.2/backward&quot; -I&quot;C:/Dev-Cpp/include/c++/3.4.2/mingw32&quot; -I&quot;C:/Dev-Cpp/include/c++/3.4.2&quot; -I&quot;C:/Dev-Cpp/include&quot;</p>
<p>main.cpp: In function <code>int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)': main.cpp:63: error:</code>hWnd' undeclared (first use this function)<br />
main.cpp:63: error: (Each undeclared identifier is reported only once for each function it appears in.)<br />
main.cpp:63: error: <code>PIXEL' undeclared (first use this function) main.cpp:63: error:</code>hInstance' undeclared (first use this function)</p>
<p>make.exe: *** [main.o] Error 1</p>
<p>Execution terminated</p>
</blockquote>
<p>Ich wäre für eure hilfe dankbar</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1431173</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1431173</guid><dc:creator><![CDATA[aoak]]></dc:creator><pubDate>Sat, 05 Jan 2008 14:58:23 GMT</pubDate></item><item><title><![CDATA[Reply to GDI und hwnd; on Sat, 05 Jan 2008 16:22:40 GMT]]></title><description><![CDATA[<p>Bei hWnd bei CreateWindow() in Zeile 63 Groß/Kleinschreibung beachten!</p>
<p>Er findet die Resource PIXEL nicht, demnach die Resourcen nicht richtig eingebunden.</p>
<p>In der WinMain heisst es bei dir hThisInstance, bei CreateWindow() gibts du aber hInstance an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1431240</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1431240</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sat, 05 Jan 2008 16:22:40 GMT</pubDate></item><item><title><![CDATA[Reply to GDI und hwnd; on Sat, 05 Jan 2008 23:53:59 GMT]]></title><description><![CDATA[<blockquote>
<p>Bei hWnd bei CreateWindow() in Zeile 63 Groß/Kleinschreibung beachten!</p>
<p>Er findet die Resource PIXEL nicht, demnach die Resourcen nicht richtig eingebunden.</p>
<p>In der WinMain heisst es bei dir hThisInstance, bei CreateWindow() gibts du aber hInstance an.</p>
</blockquote>
<p>Fehler 1 und 3 sind korrigiert. Danke.</p>
<p>Das mit der Resource verstehe ich nicht (den code teil habe ich aus dem i net)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1431543</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1431543</guid><dc:creator><![CDATA[aoak]]></dc:creator><pubDate>Sat, 05 Jan 2008 23:53:59 GMT</pubDate></item><item><title><![CDATA[Reply to GDI und hwnd; on Sun, 06 Jan 2008 00:01:31 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#define PIXEL 1000
</code></pre>
<p>... deswegen kopiert man nicht einfach Code ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1431553</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1431553</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sun, 06 Jan 2008 00:01:31 GMT</pubDate></item></channel></rss>