CreateDialog() in DLL gibt Null zurück, GetLastError() = "Der Vorgang wurde erfolgreich beendet." ?
-
Hey!
Ich habe eine Dialog Resource in einer DLL. Von außen rufe ich eine Funktion in der DLL auf, welche dies tut:
dialogHandle = CreateDialog(instanceHandle, MAKEINTRESOURCE(IDD_DIALOG1), 0, DialogProcess);Doch dialogHandle ist immer Null, wobei GetLastError() "Der Vorgang wurde erfolgreich beendet." meldet.
Der Dialog wird auch nicht angezeigt, im Dialog Editor ist jedenfalls "Visible: true" eingestellt und habe auch ne message loop am laufen.
DialogProcess ist leer (return true;), aber in einer Anwendung funktioniert es, nur nicht in einer DLL.
Das instanceHandle hole ich mir von DllMain().Was soll das?
-
instanceHandle muss das handle der DLL sein, die die resource beinhaltet, nicht des aufrufenden moduls.
-
Die DLL enthält die Dialog Resource.
Und warum ist die "Fehler"meldung "erfolgreich beendet", wenn dialogHandle NULL ist?
-
Dialog0r schrieb:
Das instanceHandle hole ich mir von DllMain().
-
Typically, the dialog box procedure should return TRUE if it processed the message, and FALSE if it did not. If the dialog box procedure returns FALSE, the dialog manager performs the default dialog operation in response to the message.
-
Oh, ich meinte natürlich "DialogProcess ist leer (return false;)".
Aber das ändert eh nix, denn das zurückgegebene Handle ist NULL.Ich kapiers nicht, was ist da jetzt so schwer dran, einen Dialog aus einer DLL zu laden?
Instance handle ist das der DLL, Resource vorhanden und trotzdem geht nix.
-
Wird die Dialog Routine angesprochen?
Bist Du sicher, dass Du GetLastError sofort aufrufst und kein anderer API Befehl davor abläuft?
-
Es lag daran, dass die Anwendung eine Konsolenanwendung war.
Jetzt, mit einer Win32 Anwendung, funktioniert es.
Die Dialogroutine wurde immer ausgeführt.
CreateDialog() direkt in der Konsolenanwendung hat aber funktioniert.