<?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[problem beim erstellen eines fensters, als Klasse]]></title><description><![CDATA[<p>nAbend, also da ich mich nun langsam mal versuche in klassen ein zu arbeiten, dachte ich mir, dass ich halt mal ne anwendung schreibe um ein einfaches Fenster zu erstellen, natürlich als class. So also hier der Plan:</p>
<pre><code class="language-cpp">#ifndef _WINDOW_H
#define _WINDOW_H

    class window {

        public:

            window( char *ti, int wi, int he );
            ~window();

        private:

            WindowProc( HWND, UINT, WPARAM, LPARAM );
            HINSTANCE hInst;
            HWND hWnd;
            WNDCLASS wc;
            MSG msg;

            char *szName;
            char *title;
            int width;
            int height;
        };

        window::window( char *ti, int wi, int he ) {

            szName = &quot;Window&quot;;
            width = wi;
            height = he;

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

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

                MessageBox( 0, &quot;Can't register this window!&quot;, &quot;Shutdown error!&quot;,
                            MB_OK | MB_ICONEXCLAMATION );
            }

            hWnd = CreateWindow( szName, title,
                                       WS_OVERLAPPEDWINDOW,
                                       CW_USEDEFAULT, CW_USEDEFAULT,
                                       width, height,
                                       0, 0,
                                       hInst,
                                       0 );

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

        window::~window() {

            DestroyWindow( hWnd );
            hWnd = 0;

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

        window::WindowProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) {

            switch( msg ) {

                case WM_CREATE: {

                    return 0;
                }

                case WM_SIZE: {

                    return 0;
                }

                case WM_PAINT: {

                    return 0;
                }

                case WM_DESTROY: {

                    PostQuitMessage( 0 );
                    return 0;
                }
            }
            return DefWindowProc( hWnd, msg, wParam, lParam );
        }

#endif
</code></pre>
<p>Doch es wär ja auch zu schön gewesen, hätte es beim ersten Mal gleich funktioniert. Es kommt ein fehler bei: “ wc.lpfnWndProc = WindowProc; “</p>
<pre><code>[C++ Error] wnd.h(33): E2235 Member function must be called or its address taken
</code></pre>
<p>und in der main():</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;windows.h&gt;
#include &quot;wnd.h&quot;
#pragma hdrstop

//---------------------------------------------------------------------------

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

    MSG msg;
    window wnd( &quot;Window!&quot;, 400, 300 );

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

        TranslateMessage( &amp;msg );
        DispatchMessage( &amp;msg );

    }
    wnd.~window();
    return 0;
}
</code></pre>
<p>Auch wenn ich die function mit window:: calle erscheint dieser fehler… auch weiter denke ich das es so noch nicht perfekt laufen kann, obwohl, wenn ich diese zeile vom compiler ignorieren lasse ( per // ), läuft der compiler alle sohne fehler durch nur beim ausführen kommt vom debugger eine fehler meldung und des fenster is auch nicht da… würdet ihr mir mal helfen?, danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/163799/problem-beim-erstellen-eines-fensters-als-klasse</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 17:51:34 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/163799.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 01 Nov 2006 20:54:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to problem beim erstellen eines fensters, als Klasse on Wed, 01 Nov 2006 20:54:30 GMT]]></title><description><![CDATA[<p>nAbend, also da ich mich nun langsam mal versuche in klassen ein zu arbeiten, dachte ich mir, dass ich halt mal ne anwendung schreibe um ein einfaches Fenster zu erstellen, natürlich als class. So also hier der Plan:</p>
<pre><code class="language-cpp">#ifndef _WINDOW_H
#define _WINDOW_H

    class window {

        public:

            window( char *ti, int wi, int he );
            ~window();

        private:

            WindowProc( HWND, UINT, WPARAM, LPARAM );
            HINSTANCE hInst;
            HWND hWnd;
            WNDCLASS wc;
            MSG msg;

            char *szName;
            char *title;
            int width;
            int height;
        };

        window::window( char *ti, int wi, int he ) {

            szName = &quot;Window&quot;;
            width = wi;
            height = he;

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

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

                MessageBox( 0, &quot;Can't register this window!&quot;, &quot;Shutdown error!&quot;,
                            MB_OK | MB_ICONEXCLAMATION );
            }

            hWnd = CreateWindow( szName, title,
                                       WS_OVERLAPPEDWINDOW,
                                       CW_USEDEFAULT, CW_USEDEFAULT,
                                       width, height,
                                       0, 0,
                                       hInst,
                                       0 );

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

        window::~window() {

            DestroyWindow( hWnd );
            hWnd = 0;

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

        window::WindowProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) {

            switch( msg ) {

                case WM_CREATE: {

                    return 0;
                }

                case WM_SIZE: {

                    return 0;
                }

                case WM_PAINT: {

                    return 0;
                }

                case WM_DESTROY: {

                    PostQuitMessage( 0 );
                    return 0;
                }
            }
            return DefWindowProc( hWnd, msg, wParam, lParam );
        }

#endif
</code></pre>
<p>Doch es wär ja auch zu schön gewesen, hätte es beim ersten Mal gleich funktioniert. Es kommt ein fehler bei: “ wc.lpfnWndProc = WindowProc; “</p>
<pre><code>[C++ Error] wnd.h(33): E2235 Member function must be called or its address taken
</code></pre>
<p>und in der main():</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;windows.h&gt;
#include &quot;wnd.h&quot;
#pragma hdrstop

//---------------------------------------------------------------------------

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

    MSG msg;
    window wnd( &quot;Window!&quot;, 400, 300 );

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

        TranslateMessage( &amp;msg );
        DispatchMessage( &amp;msg );

    }
    wnd.~window();
    return 0;
}
</code></pre>
<p>Auch wenn ich die function mit window:: calle erscheint dieser fehler… auch weiter denke ich das es so noch nicht perfekt laufen kann, obwohl, wenn ich diese zeile vom compiler ignorieren lasse ( per // ), läuft der compiler alle sohne fehler durch nur beim ausführen kommt vom debugger eine fehler meldung und des fenster is auch nicht da… würdet ihr mir mal helfen?, danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1166564</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1166564</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Wed, 01 Nov 2006 20:54:30 GMT</pubDate></item><item><title><![CDATA[Reply to problem beim erstellen eines fensters, als Klasse on Wed, 01 Nov 2006 21:51:01 GMT]]></title><description><![CDATA[<p><a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39356.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39356.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1166601</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1166601</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Wed, 01 Nov 2006 21:51:01 GMT</pubDate></item><item><title><![CDATA[Reply to problem beim erstellen eines fensters, als Klasse on Wed, 01 Nov 2006 22:12:33 GMT]]></title><description><![CDATA[<p>Also ich kenn irgwie keinen dümmeren Vollidioten als &quot;T0bi&quot;...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1166609</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1166609</guid><dc:creator><![CDATA[tzjghj]]></dc:creator><pubDate>Wed, 01 Nov 2006 22:12:33 GMT</pubDate></item><item><title><![CDATA[Reply to problem beim erstellen eines fensters, als Klasse on Thu, 02 Nov 2006 06:29:33 GMT]]></title><description><![CDATA[<p>danke, aber vieleicht könntest du dir deine gheistreichen komplimente in zukunft sparren oder für deine freunde aufheben, danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1166663</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1166663</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Thu, 02 Nov 2006 06:29:33 GMT</pubDate></item></channel></rss>