<?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[Win-CALLBACK Funktion in einer Dll]]></title><description><![CDATA[<p>Servus,</p>
<p>meine Dll gibt auf Anfrage des Hauptprogramms einen Funktionszeiger auf die in der Dll beschriebene Callback Funktion (von einer Property Sheet Page, die in einer Resource, ebenfalls in der Dll liegend definiert wird) zurück. Leider scheint das nicht richtig zu funktionieren. Die Seite, die angezeigt wird, ist stets leer. Muss ich bei der Funktionsdeklaration der CALLBACK Funktion etwas beachten? Oder bei der Resource? Es wird als C++ Projekt compiliert.</p>
<p>Danke für Antworten.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/108471/win-callback-funktion-in-einer-dll</link><generator>RSS for Node</generator><lastBuildDate>Tue, 30 Jun 2026 06:39:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/108471.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 29 Apr 2005 16:34:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Win-CALLBACK Funktion in einer Dll on Fri, 29 Apr 2005 16:34:02 GMT]]></title><description><![CDATA[<p>Servus,</p>
<p>meine Dll gibt auf Anfrage des Hauptprogramms einen Funktionszeiger auf die in der Dll beschriebene Callback Funktion (von einer Property Sheet Page, die in einer Resource, ebenfalls in der Dll liegend definiert wird) zurück. Leider scheint das nicht richtig zu funktionieren. Die Seite, die angezeigt wird, ist stets leer. Muss ich bei der Funktionsdeklaration der CALLBACK Funktion etwas beachten? Oder bei der Resource? Es wird als C++ Projekt compiliert.</p>
<p>Danke für Antworten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/778604</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/778604</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Fri, 29 Apr 2005 16:34:02 GMT</pubDate></item><item><title><![CDATA[Reply to Win-CALLBACK Funktion in einer Dll on Sat, 30 Apr 2005 17:54:33 GMT]]></title><description><![CDATA[<p>Error code scheint (mit vereinfachtem code) 1814 zu sein. MSDN spuckt dazu aus:</p>
<p>ERROR_RESOURCE_NAME_NOT_FOUND<br />
The specified resource name cannot be found in the image file.</p>
<p>Kann ich mir aber nicht vorstellen, die res ist korrekt eingebunden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/779227</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/779227</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Sat, 30 Apr 2005 17:54:33 GMT</pubDate></item><item><title><![CDATA[Reply to Win-CALLBACK Funktion in einer Dll on Sat, 30 Apr 2005 17:59:17 GMT]]></title><description><![CDATA[<p>das kann am 'hmodule' parameter von LoadResource() liegen. da muss das module handle von dem binary rein, dass die ressourcen enthält (also entweder das der dll oder das der exe, die sind unterschiedlich)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/779228</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/779228</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Sat, 30 Apr 2005 17:59:17 GMT</pubDate></item><item><title><![CDATA[Reply to Win-CALLBACK Funktion in einer Dll on Sat, 30 Apr 2005 18:09:33 GMT]]></title><description><![CDATA[<p>Muss ich LoadResource () verwenden? Die resource liegt mir doch im Quellcode vor und wird zusammen mit dem Rest der dll kompiliert. Bei meinen bisherigen Experimenten mit Resourcen (jedoch nur bei exe-files) hat das auch immer ohne spezielles laden funktioniert.<br />
Mit MAKEINTRESOURCE(IDD_DIALOG1) einfach angeben...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/779232</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/779232</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Sat, 30 Apr 2005 18:09:33 GMT</pubDate></item><item><title><![CDATA[Reply to Win-CALLBACK Funktion in einer Dll on Sat, 30 Apr 2005 19:12:42 GMT]]></title><description><![CDATA[<p>N00Bie schrieb:</p>
<blockquote>
<p>Muss ich LoadResource () verwenden? Die resource liegt mir doch im Quellcode vor und wird zusammen mit dem Rest der dll kompiliert. Bei meinen bisherigen Experimenten mit Resourcen (jedoch nur bei exe-files) hat das auch immer ohne spezielles laden funktioniert.</p>
</blockquote>
<p>LoadResource() o.ä. wird dann 'heimlich' von deiner library benutzt (ist das mfc oder sowas?). ich weiss nicht ob's da spezielle tricks gibt (bestimmt gibts die!!) aber du könntes eventuell versuchen die dlg-resource und die dazugehörige klasse in ein modul zu linken (z.b. alles in die dll)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/779257</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/779257</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Sat, 30 Apr 2005 19:12:42 GMT</pubDate></item><item><title><![CDATA[Reply to Win-CALLBACK Funktion in einer Dll on Sun, 01 May 2005 08:14:31 GMT]]></title><description><![CDATA[<p>Ich spendier jetzt mal ne Runde Code:</p>
<p>menu.h</p>
<pre><code class="language-cpp">#ifndef _MENU_H_
#define _MENU_H_

extern HINSTANCE hInst;

int HookProc(WPARAM wParam,LPARAM lParam);
BOOL CALLBACK DialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

#endif
</code></pre>
<p>menu.cpp</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;prsht.h&gt;
#include &lt;shlwapi.h&gt;

#include &quot;../resource/resource.h&quot;

#include &quot;menu.h&quot;

int HookProc(WPARAM wParam,LPARAM lParam)
{
    if (NULL == CreateDialog (hInst, MAKEINTRESOURCE(IDD_DIALOG1), 0, DialogProc))
    {
        char text[30];
        wsprintf (text, &quot;%d&quot;, GetLastError ());
        MessageBox (0, text, &quot;Error!&quot;, MB_OK);
    }

    return 0;
}

BOOL CALLBACK DialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(message)
    {
        case WM_INITDIALOG:

            TranslateDialogDefault(hwnd);
            return (TRUE);

        case WM_DESTROY:
        case WM_CLOSE:
            EndDialog (hwnd, 0); // Zu Testzwecken eingefügt
            return (TRUE);

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDC_LIST2:
                    break;
                case BU_SAVE:
                    break;
                case ED_PASSWORD:
                    break;
                case RB_NONE:
                    break;
                case RB_RC4:
                    break;
                case RB_BLOWFISH:
                    break;
                default:
                    break;
            }
            return (FALSE);
        /*case WM_NOTIFY:
            switch (((NMHDR FAR *) lParam)-&gt;code)
            {
                case PSN_SETACTIVE:
                    break;
                case PSN_KILLACTIVE:
                    SetWindowLong (hwnd, DWL_MSGRESULT, (LONG) FALSE);
                    break;
                case PSN_APPLY:
                    SetWindowLong (hwnd, DWL_MSGRESULT, (LONG) PSNRET_NOERROR);
                    break;
                default:
                    break;
            }*/
        break;
    }

    return (FALSE);
}
</code></pre>
<p>resource.h</p>
<pre><code class="language-cpp">//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by resource.rc
//
#define IDD_DIALOG1                     101
#define IDC_LIST2                       1003
#define RB_NONE                         1004
#define RB_RC4                          1005
#define RB_BLOWFISH                     1006
#define ED_PASSWORD                     1008
#define PROG_SAFETY                     1009
#define BU_SAVE                         1010
#define IDC_STATIC                      -1

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        102
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1012
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif
</code></pre>
<p>resource.rc</p>
<pre><code class="language-cpp">//Microsoft Developer Studio generated resource script.
//
#include &quot;resource.h&quot;

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include &quot;afxres.h&quot;

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// Deutsch (Deutschland) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_DIALOG1 DIALOG DISCARDABLE  0, 0, 282, 205
STYLE /*DS_MODALFRAME | */WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_CHILD
CAPTION &quot;Dialog&quot;
FONT 8, &quot;Tahoma&quot;
BEGIN
    LISTBOX         IDC_LIST2,20,13,215,78,LBS_SORT | LBS_NOINTEGRALHEIGHT | 
                    WS_VSCROLL | WS_TABSTOP
    CONTROL         &quot;keine&quot;,RB_NONE,&quot;Button&quot;,BS_AUTORADIOBUTTON | WS_GROUP,
                    27,111,33,10
    CONTROL         &quot;Rc4&quot;,RB_RC4,&quot;Button&quot;,BS_AUTORADIOBUTTON | WS_GROUP,27,
                    124,29,10
    CONTROL         &quot;Blowfish&quot;,RB_BLOWFISH,&quot;Button&quot;,BS_AUTORADIOBUTTON | 
                    WS_GROUP,27,138,57,10
    EDITTEXT        ED_PASSWORD,131,110,102,12,ES_PASSWORD | ES_AUTOHSCROLL
    CONTROL         &quot;Progress1&quot;,PROG_SAFETY,&quot;msctls_progress32&quot;,PBS_SMOOTH | 
                    WS_BORDER,130,145,103,13
    LTEXT           &quot;Sicherheit:&quot;,IDC_STATIC,130,131,45,8
    PUSHBUTTON      &quot;Speichern&quot;,BU_SAVE,21,178,48,13
    GROUPBOX        &quot;Verschlüsselung:&quot;,IDC_STATIC,21,98,91,67
    GROUPBOX        &quot;Passwort:&quot;,IDC_STATIC,127,98,112,67
END

/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE 
BEGIN
    IDD_DIALOG1, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 275
        TOPMARGIN, 7
        BOTTOMMARGIN, 198
    END
END
#endif    // APSTUDIO_INVOKED

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE 
BEGIN
    &quot;resource.h\0&quot;
END

2 TEXTINCLUDE DISCARDABLE 
BEGIN
    &quot;#include &quot;&quot;afxres.h&quot;&quot;\r\n&quot;
    &quot;\0&quot;
END

3 TEXTINCLUDE DISCARDABLE 
BEGIN
    &quot;\r\n&quot;
    &quot;\0&quot;
END

#endif    // APSTUDIO_INVOKED

#endif    // Deutsch (Deutschland) resources
/////////////////////////////////////////////////////////////////////////////

#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//

/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED
</code></pre>
<p>&lt;EDIT&gt; Was vergessen. &lt;/EDIT&gt;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/779376</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/779376</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Sun, 01 May 2005 08:14:31 GMT</pubDate></item><item><title><![CDATA[Reply to Win-CALLBACK Funktion in einer Dll on Sun, 01 May 2005 08:38:51 GMT]]></title><description><![CDATA[<p>N00Bie schrieb:</p>
<blockquote>
<pre><code class="language-cpp">if (NULL == CreateDialog (hInst, MAKEINTRESOURCE(IDD_DIALOG1), 0,....
</code></pre>
</blockquote>
<p>dieses 'hInst' ist der knackpunkt. wenn die dlgressource in der exe steckt, dann kannste dafür '(HINSTANCE)GetModuleHandle(NULL)' einsetzen. steckt die dlgresource in der dll, dann nimm den rückgabewert vom 'LoadLibrary()'-aufruf, mit dem du die dll lädst. ist der aufruf von 'CreateDialog()' selber in der dll, dann nimm den ersten parameter (hinstDLL), mit dem die 'DllMain' aufgerufen wird</p>
]]></description><link>https://www.c-plusplus.net/forum/post/779382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/779382</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Sun, 01 May 2005 08:38:51 GMT</pubDate></item><item><title><![CDATA[Reply to Win-CALLBACK Funktion in einer Dll on Sun, 01 May 2005 10:44:35 GMT]]></title><description><![CDATA[<p>Die resource steht wie der restliche code auch in der dll.<br />
hInst bekomm ich über die dll main:</p>
<p>dllmain.cpp</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;menu.h&quot;
#include &quot;dll.h&quot;

/*--------------------------------------------------------------------------*/
/*      Globals                                                             */
/*--------------------------------------------------------------------------*/

HINSTANCE hInst;

/*--------------------------------------------------------------------------*/
/*      Hauptfunktionen                                                     */
/*--------------------------------------------------------------------------*/

BOOL APIENTRY DllMain (HINSTANCE hInstDll  /* Library instance handle. */ ,
                       DWORD reason        /* Reason this function is being called. */ ,
                       LPVOID reserved     /* Not used. */ )
{
    hInst = hInstDll;

    switch (reason)
    {
      case DLL_PROCESS_ATTACH:
        break;

      case DLL_PROCESS_DETACH:
        break;

      case DLL_THREAD_ATTACH:
        break;

      case DLL_THREAD_DETACH:
        break;
    }

    /* Returns TRUE on success, FALSE on failure */
    return TRUE;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/779456</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/779456</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Sun, 01 May 2005 10:44:35 GMT</pubDate></item><item><title><![CDATA[Reply to Win-CALLBACK Funktion in einer Dll on Sun, 01 May 2005 11:13:35 GMT]]></title><description><![CDATA[<p>N00Bie schrieb:</p>
<blockquote>
<p>Die resource steht wie der restliche code auch in der dll.<br />
hInst bekomm ich über die dll main:<br />
dllmain.cpp</p>
</blockquote>
<p>das sieht ja so schlecht nicht aus (obwohl's wohl besser wär, hInst bei DLL_PROCESS_ATTACH zu initialisieren). ich kann so nix schlimmes erkennen. musste noch etwas debuggen, z.b. hInst ausgeben, eventuell die datei ausgeben (GetModuleFilename()), usw. von wo wird diese 'HookProc' aufgerufen? IDD_DIALOG1 überall 101??? musste alles mal testen. und etwas abwarten...vielleicht kann dir jemand anderes mehr dazu sagen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/779474</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/779474</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Sun, 01 May 2005 11:13:35 GMT</pubDate></item><item><title><![CDATA[Reply to Win-CALLBACK Funktion in einer Dll on Sun, 01 May 2005 12:29:13 GMT]]></title><description><![CDATA[<p>Hmm, habs mal testweise nicht mit g++ sondern mit dem gcc kompiliert (natürlich leicht angepasst). Hier funktioniert es plötzlich, obwohl die oben besprochenen Stellen identisch sind. Könnte es ein Linkerproblem sein?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/779515</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/779515</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Sun, 01 May 2005 12:29:13 GMT</pubDate></item><item><title><![CDATA[Reply to Win-CALLBACK Funktion in einer Dll on Sun, 01 May 2005 14:31:15 GMT]]></title><description><![CDATA[<p>So, Lösung steht hier:</p>
<p><a href="http://www.c-plusplus.net/forum/viewtopic-var-p-is-779596.html#779596" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-p-is-779596.html#779596</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/779598</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/779598</guid><dc:creator><![CDATA[N00Bie]]></dc:creator><pubDate>Sun, 01 May 2005 14:31:15 GMT</pubDate></item></channel></rss>