<?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[Winapi in dll]]></title><description><![CDATA[<p>Huhu <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="🙂"
    /><br />
ich wollte ein WinApi Fenster in meine DLl kompilieren.<br />
Leider bekomme ich dabei foldende Fehler:<br />
ld returned 1 exit status [Linker error] undefined reference to `WndProc@16'<br />
[Build Error] [DestinyDLL.dll] Error 1<br />
Habt ihr vielleicht eine Ahnung warum das nicht klappt?<br />
Muss ich vielleicht noch was Linken?<br />
Danke <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>
<pre><code>#define _WIN32_WINNT 0x0501
#include &lt;windows.h&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;
#define ID_BUTTON1 11001
#define ID_BUTTON2 11002
#define ID_CHECKBOX 11003
#define ID_AUSWAHL1 11004 
#define ID_AUSWAHL2 11005
#define ID_AUSWAHL3 11006
#define ID_AUSWAHL4 11007
#define ID_AUSWAHL5 11008
#define ID_AUSWAHL6 11009
#define ID_AUSWAHL7 11010
#define ID_AUSWAHL8 11011
#define ID_AUSWAHL9 11012

using namespace std;
extern &quot;C&quot; void __declspec(dllexport) Funktion()
{

//std::string szAntwort = &quot;Du hast Auswahl 1 getroffen und einen Haken gesetzt! \n&quot;;

//int g_iWort = 0;
//int g_iAusw = 0;

//void szSatz(int iAusw, int wort);

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
 //                  PSTR szCmdLine, int iCmdShow)
//{
        int iCmdShow;
       HINSTANCE hInstance;              
       HWND         hWnd;
       HWND         hButton, hButton2, hGroupbox, hAuswahl1, hAuswahl2, hAuswahl3, hAuswahl4, hAuswahl5, hAuswahl6, hAuswahl7, hAuswahl8, hAuswahl9, hCheckbox;
       MSG          msg;
       WNDCLASSEX   wc;

       // WindowClass definieren
        wc.cbSize          = sizeof(WNDCLASSEX);
        wc.style           = CS_CLASSDC;
        wc.lpfnWndProc     = WndProc;
        wc.cbClsExtra      = 0;
        wc.cbWndExtra      = 0;
        wc.hInstance       = hInstance;
        wc.hIcon           = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
        wc.hIconSm         = wc.hIcon;
        wc.hCursor         = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_ARROW));
        wc.hbrBackground   = GetSysColorBrush(COLOR_3DFACE);
        wc.lpszMenuName    = NULL;
        wc.lpszClassName   = &quot;Fenster&quot;;

       // WindowClass registreiren
        RegisterClassEx(&amp;wc);

       // Fenster definieren
        hWnd = CreateWindow(&quot;Fenster&quot;,
                       &quot;&quot;,
                       WS_CAPTION | WS_SYSMENU,
                       0,          /* X-Position auf dem Monitor */
                       0,          /* Y-Position auf dem Monitor */
                       240,                    /* Fensterbreite              */
                       300,                    /* Fensterhoehe               */
                       NULL,
                       NULL,
                       hInstance,
                       NULL);

       // Button 1
        hButton = CreateWindow(&quot;BUTTON&quot;,
                       &quot;About&quot;,
                       WS_VISIBLE | WS_CHILD ,
                       110, 15,
                       75, 25,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
        //if(!hButton) return FALSE;

        // Button 2
        hButton2 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;Abbrechen&quot;,
                       WS_VISIBLE | WS_CHILD ,
                       110, 45,
                       75, 25,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hButton2) return FALSE;

        // Auswahl 1
        hAuswahl1 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F1&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 30,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hAuswahl1) return FALSE;

        // Auswahl 2
        hAuswahl2 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F2&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 50,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hAuswahl2) return FALSE;

        // Auswahl 3
        hAuswahl3 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F3&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 70,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hAuswahl3) return FALSE;

                // Auswahl 4
        hAuswahl4 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F4&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 90,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
        //if(!hAuswahl4) return FALSE;

        hAuswahl5 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F5&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 110,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
        //if(!hAuswahl5) return FALSE;

                hAuswahl6 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F6&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 130,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hAuswahl6) return FALSE;

                hAuswahl7 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F7&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 150,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
      //  if(!hAuswahl7) return FALSE;

                hAuswahl8 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F8&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 170,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
        //if(!hAuswahl8) return FALSE;

                hAuswahl9 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F9&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 190,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hAuswahl9) return FALSE;

        // Checkbox
        hCheckbox = CreateWindow(&quot;BUTTON&quot;,
                       &quot;Sound&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
                       110, 85,
                       100, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hCheckbox) return FALSE;

        // Groupbox
        hGroupbox = CreateWindow(&quot;BUTTON&quot;,
                       &quot;Optionen&quot;,
                       WS_VISIBLE | WS_CHILD | BS_GROUPBOX,
                       10, 10,
                       80, 210,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
      //  if(!hGroupbox) return FALSE;

                //ID's vergeben
                SetWindowLong( hButton, GWL_ID, ID_BUTTON1 );
                SetWindowLong( hButton2, GWL_ID, ID_BUTTON2 );
                SetWindowLong( hCheckbox, GWL_ID, ID_CHECKBOX );
                SetWindowLong( hAuswahl1, GWL_ID, ID_AUSWAHL1 ); 
                SetWindowLong( hAuswahl2, GWL_ID, ID_AUSWAHL2 ); 
                SetWindowLong( hAuswahl3, GWL_ID, ID_AUSWAHL3 ); 
                SetWindowLong( hAuswahl4, GWL_ID, ID_AUSWAHL4 ); 
                SetWindowLong( hAuswahl5, GWL_ID, ID_AUSWAHL5 ); 
                SetWindowLong( hAuswahl6, GWL_ID, ID_AUSWAHL6 ); 
                SetWindowLong( hAuswahl7, GWL_ID, ID_AUSWAHL7 ); 
                SetWindowLong( hAuswahl8, GWL_ID, ID_AUSWAHL8 ); 
                SetWindowLong( hAuswahl9, GWL_ID, ID_AUSWAHL9 ); 

        // Die Schrift setzen
        SendMessage(hButton, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hButton2, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl1, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl2, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl3, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl4, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl5, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl6, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl7, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl8, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl9, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hCheckbox, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hGroupbox, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);

        // Fenster aqnzeigen lassen
         ShowWindow(hWnd, iCmdShow);
         UpdateWindow(hWnd);

        // Diese while-Schleifen da...
            while (GetMessage(&amp;msg, NULL, 0, 0))
            {
                      TranslateMessage(&amp;msg);
                      DispatchMessage(&amp;msg);
            }

        // Ende der WinMain
           //return msg.wParam;
}

// Callback
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{

   switch (message)
   {

   case WM_CREATE:
   // Das Fenster wurde erstellt.
   break;
   case WM_COMMAND:      
   switch( LOWORD( wParam ) )
            {
                        // OK Button
                        case ID_BUTTON1:
                        if (HIWORD(wParam) == BN_CLICKED)
                        // Satz ändern
                        //szSatz(g_iAusw, g_iWort);
                        // Messagebox ausgeben
                        MessageBox(NULL, &quot;&quot;,
                        &quot;Danke für das Nutzen des Programmes&quot;,
                        MB_ICONINFORMATION | MB_OK | MB_DEFBUTTON1);
                        // Programm beenden
                        //SendMessage(hWnd, WM_CLOSE, 0, 0);
                        break;

                        // Abbrechen Button
                        case ID_BUTTON2:
                        if (HIWORD(wParam) == BN_CLICKED)
                        SendMessage(hWnd, WM_CLOSE, 0, 0);
                        break;

                        // CheckBox
                        case ID_CHECKBOX:
                        if (BST_CHECKED == SendMessage( ( HWND )lParam, BM_GETCHECK, 0, 0 ))
                        //g_iWort = 1;

                        break;

                        // Auswahl 1
                        case ID_AUSWAHL1:
                        if (BST_CHECKED == SendMessage( ( HWND )lParam, BM_GETCHECK, 0, 0 ))
                        Beep(1000,3000);
                        break; 

                        // Auswahl 2
                        case ID_AUSWAHL2:
                        if (BST_CHECKED == SendMessage( ( HWND )lParam, BM_GETCHECK, 0, 0 ))
                        //g_iAusw = 2;
                        break;

                        // Auswahl 3
                        case ID_AUSWAHL3:
                        if (BST_CHECKED == SendMessage( ( HWND )lParam, BM_GETCHECK, 0, 0 )) 
                        //g_iAusw = 3;
                        break;
            }          

                                break;

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

//system(&quot;PAUSE&quot;);

BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
{
   return TRUE;
}
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/197509/winapi-in-dll</link><generator>RSS for Node</generator><lastBuildDate>Fri, 29 May 2026 22:32:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/197509.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 11 Nov 2007 14:13:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Winapi in dll on Sun, 11 Nov 2007 14:13:01 GMT]]></title><description><![CDATA[<p>Huhu <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="🙂"
    /><br />
ich wollte ein WinApi Fenster in meine DLl kompilieren.<br />
Leider bekomme ich dabei foldende Fehler:<br />
ld returned 1 exit status [Linker error] undefined reference to `WndProc@16'<br />
[Build Error] [DestinyDLL.dll] Error 1<br />
Habt ihr vielleicht eine Ahnung warum das nicht klappt?<br />
Muss ich vielleicht noch was Linken?<br />
Danke <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>
<pre><code>#define _WIN32_WINNT 0x0501
#include &lt;windows.h&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;
#define ID_BUTTON1 11001
#define ID_BUTTON2 11002
#define ID_CHECKBOX 11003
#define ID_AUSWAHL1 11004 
#define ID_AUSWAHL2 11005
#define ID_AUSWAHL3 11006
#define ID_AUSWAHL4 11007
#define ID_AUSWAHL5 11008
#define ID_AUSWAHL6 11009
#define ID_AUSWAHL7 11010
#define ID_AUSWAHL8 11011
#define ID_AUSWAHL9 11012

using namespace std;
extern &quot;C&quot; void __declspec(dllexport) Funktion()
{

//std::string szAntwort = &quot;Du hast Auswahl 1 getroffen und einen Haken gesetzt! \n&quot;;

//int g_iWort = 0;
//int g_iAusw = 0;

//void szSatz(int iAusw, int wort);

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
 //                  PSTR szCmdLine, int iCmdShow)
//{
        int iCmdShow;
       HINSTANCE hInstance;              
       HWND         hWnd;
       HWND         hButton, hButton2, hGroupbox, hAuswahl1, hAuswahl2, hAuswahl3, hAuswahl4, hAuswahl5, hAuswahl6, hAuswahl7, hAuswahl8, hAuswahl9, hCheckbox;
       MSG          msg;
       WNDCLASSEX   wc;

       // WindowClass definieren
        wc.cbSize          = sizeof(WNDCLASSEX);
        wc.style           = CS_CLASSDC;
        wc.lpfnWndProc     = WndProc;
        wc.cbClsExtra      = 0;
        wc.cbWndExtra      = 0;
        wc.hInstance       = hInstance;
        wc.hIcon           = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
        wc.hIconSm         = wc.hIcon;
        wc.hCursor         = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_ARROW));
        wc.hbrBackground   = GetSysColorBrush(COLOR_3DFACE);
        wc.lpszMenuName    = NULL;
        wc.lpszClassName   = &quot;Fenster&quot;;

       // WindowClass registreiren
        RegisterClassEx(&amp;wc);

       // Fenster definieren
        hWnd = CreateWindow(&quot;Fenster&quot;,
                       &quot;&quot;,
                       WS_CAPTION | WS_SYSMENU,
                       0,          /* X-Position auf dem Monitor */
                       0,          /* Y-Position auf dem Monitor */
                       240,                    /* Fensterbreite              */
                       300,                    /* Fensterhoehe               */
                       NULL,
                       NULL,
                       hInstance,
                       NULL);

       // Button 1
        hButton = CreateWindow(&quot;BUTTON&quot;,
                       &quot;About&quot;,
                       WS_VISIBLE | WS_CHILD ,
                       110, 15,
                       75, 25,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
        //if(!hButton) return FALSE;

        // Button 2
        hButton2 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;Abbrechen&quot;,
                       WS_VISIBLE | WS_CHILD ,
                       110, 45,
                       75, 25,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hButton2) return FALSE;

        // Auswahl 1
        hAuswahl1 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F1&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 30,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hAuswahl1) return FALSE;

        // Auswahl 2
        hAuswahl2 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F2&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 50,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hAuswahl2) return FALSE;

        // Auswahl 3
        hAuswahl3 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F3&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 70,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hAuswahl3) return FALSE;

                // Auswahl 4
        hAuswahl4 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F4&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 90,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
        //if(!hAuswahl4) return FALSE;

        hAuswahl5 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F5&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 110,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
        //if(!hAuswahl5) return FALSE;

                hAuswahl6 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F6&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 130,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hAuswahl6) return FALSE;

                hAuswahl7 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F7&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 150,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
      //  if(!hAuswahl7) return FALSE;

                hAuswahl8 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F8&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 170,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
        //if(!hAuswahl8) return FALSE;

                hAuswahl9 = CreateWindow(&quot;BUTTON&quot;,
                       &quot;F9&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
                       20, 190,
                       90, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hAuswahl9) return FALSE;

        // Checkbox
        hCheckbox = CreateWindow(&quot;BUTTON&quot;,
                       &quot;Sound&quot;,
                       WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
                       110, 85,
                       100, 20,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
       // if(!hCheckbox) return FALSE;

        // Groupbox
        hGroupbox = CreateWindow(&quot;BUTTON&quot;,
                       &quot;Optionen&quot;,
                       WS_VISIBLE | WS_CHILD | BS_GROUPBOX,
                       10, 10,
                       80, 210,
                       hWnd,
                       NULL,
                       hInstance,
                       NULL);
      //  if(!hGroupbox) return FALSE;

                //ID's vergeben
                SetWindowLong( hButton, GWL_ID, ID_BUTTON1 );
                SetWindowLong( hButton2, GWL_ID, ID_BUTTON2 );
                SetWindowLong( hCheckbox, GWL_ID, ID_CHECKBOX );
                SetWindowLong( hAuswahl1, GWL_ID, ID_AUSWAHL1 ); 
                SetWindowLong( hAuswahl2, GWL_ID, ID_AUSWAHL2 ); 
                SetWindowLong( hAuswahl3, GWL_ID, ID_AUSWAHL3 ); 
                SetWindowLong( hAuswahl4, GWL_ID, ID_AUSWAHL4 ); 
                SetWindowLong( hAuswahl5, GWL_ID, ID_AUSWAHL5 ); 
                SetWindowLong( hAuswahl6, GWL_ID, ID_AUSWAHL6 ); 
                SetWindowLong( hAuswahl7, GWL_ID, ID_AUSWAHL7 ); 
                SetWindowLong( hAuswahl8, GWL_ID, ID_AUSWAHL8 ); 
                SetWindowLong( hAuswahl9, GWL_ID, ID_AUSWAHL9 ); 

        // Die Schrift setzen
        SendMessage(hButton, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hButton2, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl1, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl2, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl3, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl4, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl5, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl6, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl7, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl8, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hAuswahl9, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hCheckbox, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
        SendMessage(hGroupbox, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);

        // Fenster aqnzeigen lassen
         ShowWindow(hWnd, iCmdShow);
         UpdateWindow(hWnd);

        // Diese while-Schleifen da...
            while (GetMessage(&amp;msg, NULL, 0, 0))
            {
                      TranslateMessage(&amp;msg);
                      DispatchMessage(&amp;msg);
            }

        // Ende der WinMain
           //return msg.wParam;
}

// Callback
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{

   switch (message)
   {

   case WM_CREATE:
   // Das Fenster wurde erstellt.
   break;
   case WM_COMMAND:      
   switch( LOWORD( wParam ) )
            {
                        // OK Button
                        case ID_BUTTON1:
                        if (HIWORD(wParam) == BN_CLICKED)
                        // Satz ändern
                        //szSatz(g_iAusw, g_iWort);
                        // Messagebox ausgeben
                        MessageBox(NULL, &quot;&quot;,
                        &quot;Danke für das Nutzen des Programmes&quot;,
                        MB_ICONINFORMATION | MB_OK | MB_DEFBUTTON1);
                        // Programm beenden
                        //SendMessage(hWnd, WM_CLOSE, 0, 0);
                        break;

                        // Abbrechen Button
                        case ID_BUTTON2:
                        if (HIWORD(wParam) == BN_CLICKED)
                        SendMessage(hWnd, WM_CLOSE, 0, 0);
                        break;

                        // CheckBox
                        case ID_CHECKBOX:
                        if (BST_CHECKED == SendMessage( ( HWND )lParam, BM_GETCHECK, 0, 0 ))
                        //g_iWort = 1;

                        break;

                        // Auswahl 1
                        case ID_AUSWAHL1:
                        if (BST_CHECKED == SendMessage( ( HWND )lParam, BM_GETCHECK, 0, 0 ))
                        Beep(1000,3000);
                        break; 

                        // Auswahl 2
                        case ID_AUSWAHL2:
                        if (BST_CHECKED == SendMessage( ( HWND )lParam, BM_GETCHECK, 0, 0 ))
                        //g_iAusw = 2;
                        break;

                        // Auswahl 3
                        case ID_AUSWAHL3:
                        if (BST_CHECKED == SendMessage( ( HWND )lParam, BM_GETCHECK, 0, 0 )) 
                        //g_iAusw = 3;
                        break;
            }          

                                break;

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

//system(&quot;PAUSE&quot;);

BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
{
   return TRUE;
}
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1401353</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1401353</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 11 Nov 2007 14:13:01 GMT</pubDate></item><item><title><![CDATA[Reply to Winapi in dll on Sun, 11 Nov 2007 14:54:32 GMT]]></title><description><![CDATA[<p>Was ist denn das...<br />
1. reduziere den Code auf das Wesentliche, keiner hat lust sich so viel durchzulesen.<br />
2. Du schreibst den Prototyp von WndProc IN Funktion(). Tue ihn davor deklarieren.<br />
3. mache das, dann sieht man sich wieder :).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1401385</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1401385</guid><dc:creator><![CDATA[Black Shadow]]></dc:creator><pubDate>Sun, 11 Nov 2007 14:54:32 GMT</pubDate></item><item><title><![CDATA[Reply to Winapi in dll on Sun, 11 Nov 2007 14:55:16 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>du hast die WinMain Funktion auskommentiert. So findet der Compiler auch keinen Einstiegspunkt. Tu mal die folgenden Kommentarzeilen incl. aller dazugehöriger Klammern wieder weg: (Also lediglich die zwei // wegmachen):</p>
<pre><code>//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
 //                  PSTR szCmdLine, int iCmdShow)
</code></pre>
<p>usw. ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1401388</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1401388</guid><dc:creator><![CDATA[mikey]]></dc:creator><pubDate>Sun, 11 Nov 2007 14:55:16 GMT</pubDate></item><item><title><![CDATA[Reply to Winapi in dll on Sun, 11 Nov 2007 15:02:00 GMT]]></title><description><![CDATA[<p>mikey schrieb:</p>
<blockquote>
<p>du hast die WinMain Funktion auskommentiert. So findet der Compiler auch keinen Einstiegspunkt.</p>
</blockquote>
<p>...er hat doch geschrieben dass es eine Dll-Datei ist. Und eine _DllMain_ hat er!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1401393</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1401393</guid><dc:creator><![CDATA[Black Shadow]]></dc:creator><pubDate>Sun, 11 Nov 2007 15:02:00 GMT</pubDate></item><item><title><![CDATA[Reply to Winapi in dll on Sun, 11 Nov 2007 15:11:44 GMT]]></title><description><![CDATA[<p>hi, ich hab den callback jetzt vorher deklariert danke:</p>
<pre><code class="language-cpp">using namespace std; 

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); 

extern &quot;C&quot; void __declspec(dllexport) Funktion() 
{
</code></pre>
<p>Leider weiß ich nicht was bei dem Code das wesentliche ist<br />
da ich ja Linker error bekomme und keine Zeile in der sich der Fehler befindet...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1401399</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1401399</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 11 Nov 2007 15:11:44 GMT</pubDate></item><item><title><![CDATA[Reply to Winapi in dll on Sun, 11 Nov 2007 15:59:42 GMT]]></title><description><![CDATA[<blockquote>
<p>...er hat doch geschrieben dass es eine Dll-Datei ist. Und eine _DllMain_ hat er!</p>
</blockquote>
<p>Ups, hab's zu flüchtig überlesen... <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/1401433</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1401433</guid><dc:creator><![CDATA[mikey]]></dc:creator><pubDate>Sun, 11 Nov 2007 15:59:42 GMT</pubDate></item><item><title><![CDATA[Reply to Winapi in dll on Sun, 11 Nov 2007 16:08:08 GMT]]></title><description><![CDATA[<p>wenn ich den code in einem normalen windows projekt<br />
kompiliere geht es ja...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1401445</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1401445</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 11 Nov 2007 16:08:08 GMT</pubDate></item></channel></rss>