<?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[Fenster ist nicht zu sehen]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich hab heute mal versucht eine Klasse zu schreiben die mir ein Fenster erstellt. Jedoch scheint dsa irgendwie nicht zu gehen. Ich weiß die Klasse ist klein aber es war ja nur zu Versuchszwecken.</p>
<p>Könnt Ihr mir sagen wieso das nicht geht?</p>
<pre><code class="language-cpp">class test
{
    private:
        WNDCLASS wc;
        HWND hWnd;
        HDC hDC;
        HGLRC hRC;
        MSG msg;
        HINSTANCE hInstance;
        BOOL bQuit;
    public:
        void CreatetestWindow(char* title, int width, int height);
};
</code></pre>
<pre><code class="language-cpp">void test::CreatetestWindow (char* title, int width, int height)
{
    hInstance = GetModuleHandle(NULL);
    wc.style = CS_OWNDC;
    wc.lpfnWndProc = WndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor (NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = &quot;GLViewer&quot;;
    RegisterClass (&amp;wc);

    /* create main window */
    hWnd = CreateWindow (
      &quot;GLSample&quot;, title,
      WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE,
      0, 0, width, height,
      NULL, NULL, hInstance, NULL);
}
</code></pre>
<p>Wenn ich das ganze jetzt im Hauptprogramm aufrufen möchte gehe ich so vor:</p>
<pre><code class="language-cpp">int WINAPI WinMain (HINSTANCE hInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpCmdLine,
                    int iCmdShow)
{
test testobjekt;
testobjekt.CreatetestWindow(&quot;Testtitel&quot;,640, 480);
return 0;
}
</code></pre>
<p>Das programm wird auch soweit ausgeführt jedoch sehe ich nix. Das ist sehr komisch. Wenn ich das ohne OOP ausführe sehe ich zumindest ein Fenster.</p>
<p>Wo liegt mein Fehler? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/198211/fenster-ist-nicht-zu-sehen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 10:52:13 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/198211.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Nov 2007 16:49:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fenster ist nicht zu sehen on Mon, 19 Nov 2007 16:49:55 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich hab heute mal versucht eine Klasse zu schreiben die mir ein Fenster erstellt. Jedoch scheint dsa irgendwie nicht zu gehen. Ich weiß die Klasse ist klein aber es war ja nur zu Versuchszwecken.</p>
<p>Könnt Ihr mir sagen wieso das nicht geht?</p>
<pre><code class="language-cpp">class test
{
    private:
        WNDCLASS wc;
        HWND hWnd;
        HDC hDC;
        HGLRC hRC;
        MSG msg;
        HINSTANCE hInstance;
        BOOL bQuit;
    public:
        void CreatetestWindow(char* title, int width, int height);
};
</code></pre>
<pre><code class="language-cpp">void test::CreatetestWindow (char* title, int width, int height)
{
    hInstance = GetModuleHandle(NULL);
    wc.style = CS_OWNDC;
    wc.lpfnWndProc = WndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor (NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = &quot;GLViewer&quot;;
    RegisterClass (&amp;wc);

    /* create main window */
    hWnd = CreateWindow (
      &quot;GLSample&quot;, title,
      WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE,
      0, 0, width, height,
      NULL, NULL, hInstance, NULL);
}
</code></pre>
<p>Wenn ich das ganze jetzt im Hauptprogramm aufrufen möchte gehe ich so vor:</p>
<pre><code class="language-cpp">int WINAPI WinMain (HINSTANCE hInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpCmdLine,
                    int iCmdShow)
{
test testobjekt;
testobjekt.CreatetestWindow(&quot;Testtitel&quot;,640, 480);
return 0;
}
</code></pre>
<p>Das programm wird auch soweit ausgeführt jedoch sehe ich nix. Das ist sehr komisch. Wenn ich das ohne OOP ausführe sehe ich zumindest ein Fenster.</p>
<p>Wo liegt mein Fehler? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1406026</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1406026</guid><dc:creator><![CDATA[Sebastian848]]></dc:creator><pubDate>Mon, 19 Nov 2007 16:49:55 GMT</pubDate></item><item><title><![CDATA[Reply to Fenster ist nicht zu sehen on Mon, 19 Nov 2007 16:58:52 GMT]]></title><description><![CDATA[<p>Wo führst Du denn eine Msg-Loop aus?<br />
Dein Programm beendet sich sofort wieder...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1406031</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1406031</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Mon, 19 Nov 2007 16:58:52 GMT</pubDate></item><item><title><![CDATA[Reply to Fenster ist nicht zu sehen on Mon, 19 Nov 2007 18:44:20 GMT]]></title><description><![CDATA[<p>'GLViewer' != 'GLSample'</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1406104</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1406104</guid><dc:creator><![CDATA[klassenkampf]]></dc:creator><pubDate>Mon, 19 Nov 2007 18:44:20 GMT</pubDate></item></channel></rss>