<?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[undefined reference to &#96;ChooseColorA@4&#x27;]]></title><description><![CDATA[<p>Hallo, ich hab mal wieder ein Problem. Da ich keine Ahnung hab, wo der Fehler ist, kommt erstmal ne Menge Quellcode. Ich wäre sehr dankbar, wenn ihr euch das mal Anschauen würdet.<br />
Stein und Spalte sind selbst geschriebene Klassen.<br />
Wenn ich den Teil mit ChooseColor rausmache wirds problemlos kompiliert.<br />
Ein Beispielprogramm aus meinem Buch, das die Funktion verwendet funktioniert<br />
Edit: Der wichtige Teil ist in LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ ab Zeile 89</p>
<p>4 Gewinnt.h</p>
<pre><code class="language-cpp">// Windows Header Files:
#include &lt;windows.h&gt;
#include &lt;commdlg.h&gt;

//C++ Runtime Header Files
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;iostream&gt;

//eigene Header Files
#include &quot;Spalte.h&quot;
#include &quot;Resource.h&quot;

//verwendete Konstanten
const int MAXSTEINE = 6;
const int ANZSPALTEN = 7;

//globale Variablen

//zweidimensionales Array zum Speichern der gesetzten Steine;
//0 heisst kein Stein; 1 heißt Stein von Spieler 1; 2 heißt Stein von Spieler 2;
static BYTE byZustSteine[ANZSPALTEN][MAXSTEINE]={{0}};

//verwendeter Funktionen
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
LRESULT CALLBACK SpalteWndProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK SpGwnDlgProc (HWND hDlg, UINT message,WPARAM wParam, LPARAM lParam);

//überprüft ob ein Spieler gewonnen hat
bool HatGewonnen(BYTE[][MAXSTEINE],BYTE, const int, const int);

BOOL ChooseColor(LPCHOOSECOLOR lpcc);

//eigene Nachrichten
//WPARAM enthält wessen Farbe geändert wurde
//LPARAM enthält die Farbe
UINT PN_CLRCHANGED=WM_APP+1;
</code></pre>
<p>4 Gewinnt.cpp</p>
<pre><code class="language-cpp">/*-----------------------------------------------------------------------
  Vier Gewinnt von Jonas Peter.
  Dieses Programm befindet sich noch in der Entwicklung
  -----------------------------------------------------------------------*/

#include &quot;4 Gewinnt.h&quot;
#include &lt;windows.h&gt;
#include &lt;commdlg.h&gt;

using namespace std;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     static string sAppName = TEXT (&quot;Vier Gewinnt&quot;) ;
     HWND         hwnd ;
     MSG          msg ;
     WNDCLASS     wndclass ;

     wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = 0;
     wndclass.hInstance     = hInstance ;
     wndclass.hIcon         = LoadIcon(hInstance,MAKEINTRESOURCE(IDI_VIERGEWINNT)) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
     wndclass.lpszMenuName  = MAKEINTRESOURCE(IDR_MENUE) ;
     wndclass.lpszClassName = sAppName.c_str();

     if (!RegisterClass (&amp;wndclass))
     {    // UNICODE-Compilierung ist die einzige realistische Fehlermöglichkeit
          MessageBox (NULL, TEXT (&quot;Programm arbeitet mit Unicode und setzt Windows NT voraus!&quot;),
                      sAppName.c_str(), MB_ICONERROR) ;
          return 0 ;
     }

     wndclass.lpfnWndProc =SpalteWndProc;
     //Für jedes Childfenster extra Speicherbereich für einen Zeiger vom Typ Spalte anfordern
     wndclass.cbWndExtra =sizeof(long);

     wndclass.hIcon=NULL;
     wndclass.lpszClassName=&quot;Spalte&quot;;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (LTGRAY_BRUSH) ;

     RegisterClass (&amp;wndclass);

    hwnd = CreateWindow (sAppName.c_str(),                 // Name der Fensterklasse
                TEXT (&quot;Vier Gewinnt&quot;),  // Fenstertitel
                WS_OVERLAPPEDWINDOW,
                CW_USEDEFAULT,                      // X-Position des Fensters
                CW_USEDEFAULT,                      // Y-Position des Fensters
                CW_USEDEFAULT,                      // Fensterbreite
                CW_USEDEFAULT,                      // Fensterhöhe
                NULL,                               // übergeordnetes Fenster
                NULL,                               // Menü
                hInstance,                          // Programm-Kopiezähler (Programm-ID)
                NULL);                             // zusätzliche Parameter

     ShowWindow (hwnd, iCmdShow) ;
     UpdateWindow (hwnd) ;

     while (GetMessage (&amp;msg, NULL, 0, 0))
     {
          TranslateMessage (&amp;msg) ;
          DispatchMessage (&amp;msg) ;
     }
     return msg.wParam ;
}

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){

    //Handles für die Childfenster
    static HWND hwndSpalte[ANZSPALTEN];

    //Größenangaben für die Spalten
    const int lSpalteBreite=50, lSpalteHoehe=lSpalteBreite*MAXSTEINE;

    //für die Farbauswahl
    static CHOOSECOLOR  cc;
    static COLORREF     acrCustColors[16];
    static COLORREF     crCurrent=0;

     cc.lStructSize    = sizeof (CHOOSECOLOR) ;
     cc.hwndOwner      = NULL ;
     cc.hInstance      = NULL ;
     cc.rgbResult      = RGB (0x80, 0x80, 0x80) ;
     cc.lpCustColors   = acrCustColors ;
     cc.Flags          = CC_RGBINIT | CC_FULLOPEN ;
     cc.lCustData      = 0 ;
     cc.lpfnHook       = NULL ;
     cc.lpTemplateName = NULL ;

    switch (message)
    {

    case WM_CREATE:
        static HINSTANCE hInstance;

        hInstance=((LPCREATESTRUCT) lParam)-&gt;hInstance;

        //Spalten Erzeugen
        for(int i=1;i&lt;=ANZSPALTEN;i++)
        {
            hwndSpalte[i]=CreateWindow(&quot;Spalte&quot;,NULL,//KlassenName , Titelleiste
            WS_CHILDWINDOW|WS_VISIBLE, //Fensterstil
            (i*lSpalteBreite),lSpalteBreite, //Position
            lSpalteBreite, lSpalteHoehe, //Breite, Höhe
            hwnd,(HMENU) (i), //Parent Handle,  ChildID
            (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), //KopieZähler
            NULL);//Extras
        }

        return 0 ;

    case WM_SYSCOMMAND:
        switch (wParam)
        {
        //Nach Maximieren zum neu zeichnen auffordern
        case SC_MAXIMIZE:
            InvalidateRect(hwnd,NULL,false);
            UpdateWindow(hwnd);
            break;
        default:
            DefWindowProc(hwnd,message,wParam,lParam);
            break;
        }
        return 0;

    case WM_COMMAND:
        switch (LOWORD( wParam ))
        {
        case IDM_\1:
            DialogBox( hInstance, MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc );
            return 0;
        case IDM_OPTIONEN_FARBESP1:

            if (ChooseColor(&amp;cc)==TRUE)
            {
                crCurrent = cc.rgbResult;
                //Alle Spalten über die Farbänderung informieren
                for(int i=0;i&lt;ANZSPALTEN;i++)
                {
                    SendMessage(hwndSpalte[i],PN_CLRCHANGED,(WPARAM)1,(LPARAM)crCurrent);
                }

            }
            return 0;
        }

            return 0;

    case WM_DESTROY:
        PostQuitMessage (0) ;
        return 0 ;
    }
    return DefWindowProc (hwnd, message, wParam, lParam) ;
}

LRESULT CALLBACK SpalteWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){

    HDC             hdc ;
    RECT            rect ;
    PAINTSTRUCT     ps;
    //Zeiger auf den jeweiligen Speicherbereich, in dem die Daten der Spalten sind
    Spalte          *pspSpalte=NULL;

    static COLORREF crSteinFarbe=0x0;
    const COLORREF  crSteinRot=RGB(200,0,0),crSteinBlau=RGB(0,0,200);

    static BYTE byAktSpieler=1;
    //zweidimensionales Array zum Speichern der gesetzten Steine;
    //0 heisst kein Stein; 1 heißt Stein von Spieler 1; 2 heißt Stein von Spieler 2;

    switch (message)
    {
    case WM_CREATE:
        //Größe des Childfensters rausfinden
        GetClientRect(hwnd,&amp;rect);

        //Speicherbereich für eine Spalte in der größe des Childfensters anfordern.
        //im extra angeforderten Speicher einen Zeiger auf diesen Bereich speichern
        SetWindowLong(hwnd,0,(long)new Spalte(hwnd, MAXSTEINE, rect.right, rect.bottom,RGB(0,200,0)));

        return 0 ;

    case WM_PAINT:
        pspSpalte=(Spalte*)GetWindowLong(hwnd,0);
        hdc = BeginPaint(hwnd, &amp;ps);
        pspSpalte-&gt;zeichne(hdc);
        EndPaint(hwnd, &amp;ps);
        return 0;

    case WM_LBUTTONUP:
        //Überprüfen welcher Spielr Aktiv ist und entsprechende Farbe setzen
        if(1==byAktSpieler)
        {
            crSteinFarbe=crSteinRot;
        }
        else
        {
            crSteinFarbe=crSteinBlau;
        }

        //Zeiger auf das Spaltenobjekt holen, der zum aktuellen Fenster gehört
        pspSpalte=(Spalte*)GetWindowLong(hwnd,0);

        //Stein in der aktuellen Farbe setzen
        //Wenn die Spalte voll ist, wird der Funktionsaufruf beendet,
        //ohne dass byZustSteine geändert wird und byAktSpieler
        if(!pspSpalte-&gt;setzeStein(crSteinFarbe))
        {
            return 0;
        }
        //In byZustSteine speichern, wo der Stein gesetzt wurde
        byZustSteine[GetWindowLong(hwnd,GWL_ID)][pspSpalte-&gt;getFuellHoehe()]=byAktSpieler;

        //Fenster zum neu zeichnen auffordern
        InvalidateRect(hwnd,NULL,false);
        UpdateWindow(hwnd);

        //Steine zu testzwecken ausgeben
        for(int j=0;j&lt;MAXSTEINE;j++)
        {
            cout &lt;&lt; endl;
            for(int i=0;i&lt;ANZSPALTEN;i++)
            {
                cout &lt;&lt; (int)byZustSteine[i][j];
            }
        }

        //Überprüfen, ob der Spieler gewonnen hat. Wenn ja Programm beenden
        if(HatGewonnen(byZustSteine,byAktSpieler,GetWindowLong(hwnd,GWL_ID),pspSpalte-&gt;getFuellHoehe()))
        {
            //Wenn Spieler 1 Aktiv SP1GWN Dialogbox aufrufen
            if(1==byAktSpieler)
            {
                DialogBox((HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), MAKEINTRESOURCE(IDD_SP1GWN), hwnd, SpGwnDlgProc );
            }
            //Wenn Spieler 2 Aktiv SP2GWN Dialogbox auffrufen
            else
            {
                DialogBox((HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), MAKEINTRESOURCE(IDD_SP2GWN), hwnd, SpGwnDlgProc );
            }

            SendMessage(GetParent(hwnd), WM_DESTROY, 0, 0);
        }
        //anderen Spieler als aktiv setzen
        if(1==byAktSpieler)
        {
            byAktSpieler=2;
        }
        else
        {
            byAktSpieler=1;
        }

        return 0;

    case WM_DESTROY:
        pspSpalte=(Spalte*)GetWindowLong(hwnd,0);
        delete pspSpalte;
        PostQuitMessage (0) ;
        return 0 ;
    }
    return DefWindowProc (hwnd, message, wParam, lParam) ;
}

//Prozedur für den About dialog
BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT message,
                            WPARAM wParam, LPARAM lParam)
{
     switch (message)
     {
     case WM_INITDIALOG :
          return TRUE ;

     case WM_COMMAND :
          switch (LOWORD (wParam))
          {
          case IDOK :
          case IDCANCEL :
               EndDialog (hDlg, 0) ;
               return TRUE ;
          }
          break ;
     }
     return FALSE ;
}

//Prozedur für den About dialog
BOOL CALLBACK SpGwnDlgProc (HWND hDlg, UINT message,
                            WPARAM wParam, LPARAM lParam)
{
     switch (message)
     {
     case WM_INITDIALOG :
          return TRUE ;

     case WM_COMMAND :
          switch (LOWORD (wParam))
          {
          case IDOK :
          case IDCANCEL :
               EndDialog (hDlg, 0) ;
               return TRUE ;
          }
          break ;
     }
     return FALSE ;
}
</code></pre>
<p>Buildlog</p>
<blockquote>
<p>-------------- Build: Debug in Vier Gewinnt ---------------<br />
Compiling: 4 Gewinnt.cpp<br />
E:\99VerlegtvonC\Eigene Dateien\Schule\IT Projekt\Vier Gewinnt\4 Gewinnt.cpp:19: warning: unused parameter 'hPrevInstance'<br />
E:\99VerlegtvonC\Eigene Dateien\Schule\IT Projekt\Vier Gewinnt\4 Gewinnt.cpp:19: warning: unused parameter 'szCmdLine'<br />
E:\99VerlegtvonC\Eigene Dateien\Schule\IT Projekt\Vier Gewinnt\4 Gewinnt.cpp:286: warning: unused parameter 'lParam'<br />
E:\99VerlegtvonC\Eigene Dateien\Schule\IT Projekt\Vier Gewinnt\4 Gewinnt.cpp:308: warning: unused parameter 'lParam'<br />
Linking console executable: bin\Debug\Vier Gewinnt.exe<br />
obj\Debug\4 Gewinnt.o: In function `Z7WndProcP6HWND__jjl':E:/99VerlegtvonC/Eigene Dateien/Schule/IT Projekt/Vier Gewinnt/4 Gewinnt.cpp:149: undefined reference to `ChooseColorA@4'<br />
collect2: ld returned 1 exit status<br />
Process terminated with status 1 (0 minutes, 2 seconds)<br />
1 errors, 4 warnings</p>
</blockquote>
<p>Held</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/183531/undefined-reference-to-choosecolora-4</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Jul 2026 01:13:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/183531.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 05 Jun 2007 20:42:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to undefined reference to &#96;ChooseColorA@4&#x27; on Tue, 05 Jun 2007 20:44:45 GMT]]></title><description><![CDATA[<p>Hallo, ich hab mal wieder ein Problem. Da ich keine Ahnung hab, wo der Fehler ist, kommt erstmal ne Menge Quellcode. Ich wäre sehr dankbar, wenn ihr euch das mal Anschauen würdet.<br />
Stein und Spalte sind selbst geschriebene Klassen.<br />
Wenn ich den Teil mit ChooseColor rausmache wirds problemlos kompiliert.<br />
Ein Beispielprogramm aus meinem Buch, das die Funktion verwendet funktioniert<br />
Edit: Der wichtige Teil ist in LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ ab Zeile 89</p>
<p>4 Gewinnt.h</p>
<pre><code class="language-cpp">// Windows Header Files:
#include &lt;windows.h&gt;
#include &lt;commdlg.h&gt;

//C++ Runtime Header Files
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;iostream&gt;

//eigene Header Files
#include &quot;Spalte.h&quot;
#include &quot;Resource.h&quot;

//verwendete Konstanten
const int MAXSTEINE = 6;
const int ANZSPALTEN = 7;

//globale Variablen

//zweidimensionales Array zum Speichern der gesetzten Steine;
//0 heisst kein Stein; 1 heißt Stein von Spieler 1; 2 heißt Stein von Spieler 2;
static BYTE byZustSteine[ANZSPALTEN][MAXSTEINE]={{0}};

//verwendeter Funktionen
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
LRESULT CALLBACK SpalteWndProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK SpGwnDlgProc (HWND hDlg, UINT message,WPARAM wParam, LPARAM lParam);

//überprüft ob ein Spieler gewonnen hat
bool HatGewonnen(BYTE[][MAXSTEINE],BYTE, const int, const int);

BOOL ChooseColor(LPCHOOSECOLOR lpcc);

//eigene Nachrichten
//WPARAM enthält wessen Farbe geändert wurde
//LPARAM enthält die Farbe
UINT PN_CLRCHANGED=WM_APP+1;
</code></pre>
<p>4 Gewinnt.cpp</p>
<pre><code class="language-cpp">/*-----------------------------------------------------------------------
  Vier Gewinnt von Jonas Peter.
  Dieses Programm befindet sich noch in der Entwicklung
  -----------------------------------------------------------------------*/

#include &quot;4 Gewinnt.h&quot;
#include &lt;windows.h&gt;
#include &lt;commdlg.h&gt;

using namespace std;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     static string sAppName = TEXT (&quot;Vier Gewinnt&quot;) ;
     HWND         hwnd ;
     MSG          msg ;
     WNDCLASS     wndclass ;

     wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = 0;
     wndclass.hInstance     = hInstance ;
     wndclass.hIcon         = LoadIcon(hInstance,MAKEINTRESOURCE(IDI_VIERGEWINNT)) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
     wndclass.lpszMenuName  = MAKEINTRESOURCE(IDR_MENUE) ;
     wndclass.lpszClassName = sAppName.c_str();

     if (!RegisterClass (&amp;wndclass))
     {    // UNICODE-Compilierung ist die einzige realistische Fehlermöglichkeit
          MessageBox (NULL, TEXT (&quot;Programm arbeitet mit Unicode und setzt Windows NT voraus!&quot;),
                      sAppName.c_str(), MB_ICONERROR) ;
          return 0 ;
     }

     wndclass.lpfnWndProc =SpalteWndProc;
     //Für jedes Childfenster extra Speicherbereich für einen Zeiger vom Typ Spalte anfordern
     wndclass.cbWndExtra =sizeof(long);

     wndclass.hIcon=NULL;
     wndclass.lpszClassName=&quot;Spalte&quot;;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (LTGRAY_BRUSH) ;

     RegisterClass (&amp;wndclass);

    hwnd = CreateWindow (sAppName.c_str(),                 // Name der Fensterklasse
                TEXT (&quot;Vier Gewinnt&quot;),  // Fenstertitel
                WS_OVERLAPPEDWINDOW,
                CW_USEDEFAULT,                      // X-Position des Fensters
                CW_USEDEFAULT,                      // Y-Position des Fensters
                CW_USEDEFAULT,                      // Fensterbreite
                CW_USEDEFAULT,                      // Fensterhöhe
                NULL,                               // übergeordnetes Fenster
                NULL,                               // Menü
                hInstance,                          // Programm-Kopiezähler (Programm-ID)
                NULL);                             // zusätzliche Parameter

     ShowWindow (hwnd, iCmdShow) ;
     UpdateWindow (hwnd) ;

     while (GetMessage (&amp;msg, NULL, 0, 0))
     {
          TranslateMessage (&amp;msg) ;
          DispatchMessage (&amp;msg) ;
     }
     return msg.wParam ;
}

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){

    //Handles für die Childfenster
    static HWND hwndSpalte[ANZSPALTEN];

    //Größenangaben für die Spalten
    const int lSpalteBreite=50, lSpalteHoehe=lSpalteBreite*MAXSTEINE;

    //für die Farbauswahl
    static CHOOSECOLOR  cc;
    static COLORREF     acrCustColors[16];
    static COLORREF     crCurrent=0;

     cc.lStructSize    = sizeof (CHOOSECOLOR) ;
     cc.hwndOwner      = NULL ;
     cc.hInstance      = NULL ;
     cc.rgbResult      = RGB (0x80, 0x80, 0x80) ;
     cc.lpCustColors   = acrCustColors ;
     cc.Flags          = CC_RGBINIT | CC_FULLOPEN ;
     cc.lCustData      = 0 ;
     cc.lpfnHook       = NULL ;
     cc.lpTemplateName = NULL ;

    switch (message)
    {

    case WM_CREATE:
        static HINSTANCE hInstance;

        hInstance=((LPCREATESTRUCT) lParam)-&gt;hInstance;

        //Spalten Erzeugen
        for(int i=1;i&lt;=ANZSPALTEN;i++)
        {
            hwndSpalte[i]=CreateWindow(&quot;Spalte&quot;,NULL,//KlassenName , Titelleiste
            WS_CHILDWINDOW|WS_VISIBLE, //Fensterstil
            (i*lSpalteBreite),lSpalteBreite, //Position
            lSpalteBreite, lSpalteHoehe, //Breite, Höhe
            hwnd,(HMENU) (i), //Parent Handle,  ChildID
            (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), //KopieZähler
            NULL);//Extras
        }

        return 0 ;

    case WM_SYSCOMMAND:
        switch (wParam)
        {
        //Nach Maximieren zum neu zeichnen auffordern
        case SC_MAXIMIZE:
            InvalidateRect(hwnd,NULL,false);
            UpdateWindow(hwnd);
            break;
        default:
            DefWindowProc(hwnd,message,wParam,lParam);
            break;
        }
        return 0;

    case WM_COMMAND:
        switch (LOWORD( wParam ))
        {
        case IDM_\1:
            DialogBox( hInstance, MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc );
            return 0;
        case IDM_OPTIONEN_FARBESP1:

            if (ChooseColor(&amp;cc)==TRUE)
            {
                crCurrent = cc.rgbResult;
                //Alle Spalten über die Farbänderung informieren
                for(int i=0;i&lt;ANZSPALTEN;i++)
                {
                    SendMessage(hwndSpalte[i],PN_CLRCHANGED,(WPARAM)1,(LPARAM)crCurrent);
                }

            }
            return 0;
        }

            return 0;

    case WM_DESTROY:
        PostQuitMessage (0) ;
        return 0 ;
    }
    return DefWindowProc (hwnd, message, wParam, lParam) ;
}

LRESULT CALLBACK SpalteWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){

    HDC             hdc ;
    RECT            rect ;
    PAINTSTRUCT     ps;
    //Zeiger auf den jeweiligen Speicherbereich, in dem die Daten der Spalten sind
    Spalte          *pspSpalte=NULL;

    static COLORREF crSteinFarbe=0x0;
    const COLORREF  crSteinRot=RGB(200,0,0),crSteinBlau=RGB(0,0,200);

    static BYTE byAktSpieler=1;
    //zweidimensionales Array zum Speichern der gesetzten Steine;
    //0 heisst kein Stein; 1 heißt Stein von Spieler 1; 2 heißt Stein von Spieler 2;

    switch (message)
    {
    case WM_CREATE:
        //Größe des Childfensters rausfinden
        GetClientRect(hwnd,&amp;rect);

        //Speicherbereich für eine Spalte in der größe des Childfensters anfordern.
        //im extra angeforderten Speicher einen Zeiger auf diesen Bereich speichern
        SetWindowLong(hwnd,0,(long)new Spalte(hwnd, MAXSTEINE, rect.right, rect.bottom,RGB(0,200,0)));

        return 0 ;

    case WM_PAINT:
        pspSpalte=(Spalte*)GetWindowLong(hwnd,0);
        hdc = BeginPaint(hwnd, &amp;ps);
        pspSpalte-&gt;zeichne(hdc);
        EndPaint(hwnd, &amp;ps);
        return 0;

    case WM_LBUTTONUP:
        //Überprüfen welcher Spielr Aktiv ist und entsprechende Farbe setzen
        if(1==byAktSpieler)
        {
            crSteinFarbe=crSteinRot;
        }
        else
        {
            crSteinFarbe=crSteinBlau;
        }

        //Zeiger auf das Spaltenobjekt holen, der zum aktuellen Fenster gehört
        pspSpalte=(Spalte*)GetWindowLong(hwnd,0);

        //Stein in der aktuellen Farbe setzen
        //Wenn die Spalte voll ist, wird der Funktionsaufruf beendet,
        //ohne dass byZustSteine geändert wird und byAktSpieler
        if(!pspSpalte-&gt;setzeStein(crSteinFarbe))
        {
            return 0;
        }
        //In byZustSteine speichern, wo der Stein gesetzt wurde
        byZustSteine[GetWindowLong(hwnd,GWL_ID)][pspSpalte-&gt;getFuellHoehe()]=byAktSpieler;

        //Fenster zum neu zeichnen auffordern
        InvalidateRect(hwnd,NULL,false);
        UpdateWindow(hwnd);

        //Steine zu testzwecken ausgeben
        for(int j=0;j&lt;MAXSTEINE;j++)
        {
            cout &lt;&lt; endl;
            for(int i=0;i&lt;ANZSPALTEN;i++)
            {
                cout &lt;&lt; (int)byZustSteine[i][j];
            }
        }

        //Überprüfen, ob der Spieler gewonnen hat. Wenn ja Programm beenden
        if(HatGewonnen(byZustSteine,byAktSpieler,GetWindowLong(hwnd,GWL_ID),pspSpalte-&gt;getFuellHoehe()))
        {
            //Wenn Spieler 1 Aktiv SP1GWN Dialogbox aufrufen
            if(1==byAktSpieler)
            {
                DialogBox((HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), MAKEINTRESOURCE(IDD_SP1GWN), hwnd, SpGwnDlgProc );
            }
            //Wenn Spieler 2 Aktiv SP2GWN Dialogbox auffrufen
            else
            {
                DialogBox((HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), MAKEINTRESOURCE(IDD_SP2GWN), hwnd, SpGwnDlgProc );
            }

            SendMessage(GetParent(hwnd), WM_DESTROY, 0, 0);
        }
        //anderen Spieler als aktiv setzen
        if(1==byAktSpieler)
        {
            byAktSpieler=2;
        }
        else
        {
            byAktSpieler=1;
        }

        return 0;

    case WM_DESTROY:
        pspSpalte=(Spalte*)GetWindowLong(hwnd,0);
        delete pspSpalte;
        PostQuitMessage (0) ;
        return 0 ;
    }
    return DefWindowProc (hwnd, message, wParam, lParam) ;
}

//Prozedur für den About dialog
BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT message,
                            WPARAM wParam, LPARAM lParam)
{
     switch (message)
     {
     case WM_INITDIALOG :
          return TRUE ;

     case WM_COMMAND :
          switch (LOWORD (wParam))
          {
          case IDOK :
          case IDCANCEL :
               EndDialog (hDlg, 0) ;
               return TRUE ;
          }
          break ;
     }
     return FALSE ;
}

//Prozedur für den About dialog
BOOL CALLBACK SpGwnDlgProc (HWND hDlg, UINT message,
                            WPARAM wParam, LPARAM lParam)
{
     switch (message)
     {
     case WM_INITDIALOG :
          return TRUE ;

     case WM_COMMAND :
          switch (LOWORD (wParam))
          {
          case IDOK :
          case IDCANCEL :
               EndDialog (hDlg, 0) ;
               return TRUE ;
          }
          break ;
     }
     return FALSE ;
}
</code></pre>
<p>Buildlog</p>
<blockquote>
<p>-------------- Build: Debug in Vier Gewinnt ---------------<br />
Compiling: 4 Gewinnt.cpp<br />
E:\99VerlegtvonC\Eigene Dateien\Schule\IT Projekt\Vier Gewinnt\4 Gewinnt.cpp:19: warning: unused parameter 'hPrevInstance'<br />
E:\99VerlegtvonC\Eigene Dateien\Schule\IT Projekt\Vier Gewinnt\4 Gewinnt.cpp:19: warning: unused parameter 'szCmdLine'<br />
E:\99VerlegtvonC\Eigene Dateien\Schule\IT Projekt\Vier Gewinnt\4 Gewinnt.cpp:286: warning: unused parameter 'lParam'<br />
E:\99VerlegtvonC\Eigene Dateien\Schule\IT Projekt\Vier Gewinnt\4 Gewinnt.cpp:308: warning: unused parameter 'lParam'<br />
Linking console executable: bin\Debug\Vier Gewinnt.exe<br />
obj\Debug\4 Gewinnt.o: In function `Z7WndProcP6HWND__jjl':E:/99VerlegtvonC/Eigene Dateien/Schule/IT Projekt/Vier Gewinnt/4 Gewinnt.cpp:149: undefined reference to `ChooseColorA@4'<br />
collect2: ld returned 1 exit status<br />
Process terminated with status 1 (0 minutes, 2 seconds)<br />
1 errors, 4 warnings</p>
</blockquote>
<p>Held</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1299613</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1299613</guid><dc:creator><![CDATA[Held vom Erdbeerfeld]]></dc:creator><pubDate>Tue, 05 Jun 2007 20:44:45 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to &#96;ChooseColorA@4&#x27; on Tue, 05 Jun 2007 21:11:09 GMT]]></title><description><![CDATA[<p><a href="http://msdn2.microsoft.com/en-us/library/ms646912.aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/ms646912.aspx</a> sagt du musst Comdlg32.lib einbinden!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1299632</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1299632</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Tue, 05 Jun 2007 21:11:09 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to &#96;ChooseColorA@4&#x27; on Tue, 05 Jun 2007 21:56:06 GMT]]></title><description><![CDATA[<p>Die müsste ich irgendwo in den Einstellungen bei Codeblocks schon eingebunden haben. Ein anderes Programm, dass diese Funktion benutzt funktioniert ja ohne Probleme mit den selben Einstellungen. Deshalb bin ich ja so ratlos.<br />
Ich erstell jetzt mal ein neues Projekt mit Standardeinstellungen und schau ob's funktioniert.</p>
<p>Edit: geht immer noch nicht. Ich hab mal das ganze Projekt hochgeladen.<br />
<a href="http://rapidshare.com/files/35458358/Vier_Gewinnt.rar.html" rel="nofollow">http://rapidshare.com/files/35458358/Vier_Gewinnt.rar.html</a><br />
Ich wäre wirklich froh, wenn sich jemand die Zeit nähme sich das mal anzuschauen.</p>
<p>Held</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1299642</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1299642</guid><dc:creator><![CDATA[Held vom Erdbeerfeld]]></dc:creator><pubDate>Tue, 05 Jun 2007 21:56:06 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to &#96;ChooseColorA@4&#x27; on Tue, 05 Jun 2007 23:26:42 GMT]]></title><description><![CDATA[<p>Buildlog schrieb:</p>
<blockquote>
<p>undefined reference to `ChooseColorA@4'</p>
</blockquote>
<p>Der sucht den &quot;ChooseColor ()&quot;, den Du in der &quot;4 Gewinnt.h&quot; zwar deklariert hast, aber nirgendwo definiert.<br />
Kommentiere die Deklaration mal aus :</p>
<pre><code class="language-cpp">// in 4 Gewinnt.h

// BOOL ChooseColor(LPCHOOSECOLOR lpcc);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1299675</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1299675</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Tue, 05 Jun 2007 23:26:42 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to &#96;ChooseColorA@4&#x27; on Wed, 06 Jun 2007 06:04:42 GMT]]></title><description><![CDATA[<p>Wie geeky schon schrieb, du musst die comdlg32.lib einbinden.</p>
<p>Ansonsten kannst Du die Deklaration von BOOL ChooseColor(LPCHOOSECOLOR lpcc); auch weglassen. Die ist ja in der commdlg.h schon drin.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1299711</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1299711</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Wed, 06 Jun 2007 06:04:42 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to &#96;ChooseColorA@4&#x27; on Wed, 06 Jun 2007 08:42:13 GMT]]></title><description><![CDATA[<p>Ich hab die Bibliothek nochmal explizit beim Linker angegeben und jetzt funktioniert's auch. Ich dachte, es reicht wenn ich den übergeordneten Ordner angebe.<br />
Ich frage mich nur noch, warum dieses Programm funktioniert, ohne dass ich die Bibliothek einbinde.</p>
<pre><code class="language-cpp">/*---------------------------------------------------
   COLORS3.C -- COLORS3.C -- Farbauswahl über COMMDLG
                (c) Charles Petzold, 1998
  ---------------------------------------------------*/

#include &lt;windows.h&gt;
#include &lt;commdlg.h&gt;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     static CHOOSECOLOR cc ;
     static COLORREF    crCustColors[16] ;

     cc.lStructSize    = sizeof (CHOOSECOLOR) ;
     cc.hwndOwner      = NULL ;
     cc.hInstance      = NULL ;
     cc.rgbResult      = RGB (0x80, 0x80, 0x80) ;
     cc.lpCustColors   = crCustColors ;
     cc.Flags          = CC_RGBINIT | CC_FULLOPEN ;
     cc.lCustData      = 0 ;
     cc.lpfnHook       = NULL ;
     cc.lpTemplateName = NULL ;

     return ChooseColor (&amp;cc) ;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1299797</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1299797</guid><dc:creator><![CDATA[Held vom Erdbeerfeld]]></dc:creator><pubDate>Wed, 06 Jun 2007 08:42:13 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to &#96;ChooseColorA@4&#x27; on Wed, 06 Jun 2007 08:43:55 GMT]]></title><description><![CDATA[<p>In diesem Programm sehe ich aber nicht welche Linker Optionen Du angegeben hast.<br />
Zusätzlich gint es auch #pragma comment(lib,...) was ich imer verwende.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1299801</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1299801</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Wed, 06 Jun 2007 08:43:55 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to &#96;ChooseColorA@4&#x27; on Wed, 06 Jun 2007 08:51:02 GMT]]></title><description><![CDATA[<p>Du kannst es bei dir mal ausprobieren. Ich bin mir ziemlich sicher, dass ich die Bibliothek beim Linker nicht explizit angegeben habe. Aber eigentlich ist es egal, Hauptsache mein Programm läuft.<br />
Danke für die geduldige Hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1299811</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1299811</guid><dc:creator><![CDATA[Held vom Erdbeerfeld]]></dc:creator><pubDate>Wed, 06 Jun 2007 08:51:02 GMT</pubDate></item></channel></rss>