Hallo,
ich habe ein Formular in eine DLL gepackt. Es funktioniert auch alles wunderbar. Nun wollte ich mit den ADO-Komponenten über MySQL ODBC 3.51 Driver auf eine MySQL-Datenbank zugreifen.
Wenn ich jetzt das Formular aufrufe mit :
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
| procedure TMainControl.Address_AdministrationClick(Sender: TObject); var hDLL : THandle; AddressWindow : TAddressWindow; begin hDLL := LoadLibrary(PChar(ExtractFilePath(ParamStr(0))+'address.dll')); if hDLL <> 0 then begin try AddressWindow := GetProcAddress(hDLL, 'address_administration'); AddressWindow(Application.Handle); finally FreeLibrary(hDLL); end; end; end; |
Bekomme ich den folgenden Fehler :
| Zitat: |
| Project xxx.exe raised exception class EOleSysError with message 'CoInitialize wurde nicht aufgerufen'. Process stopped. Use Step or Run to continue. |
Dieser Fehler tritt bei Zeile 20 auf im Projektcode von der DLL :
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36:
| library address;
uses SysUtils, Classes, Windows, Forms, Controls, ExtCtrls, AddressAdministrationUnit in 'AddressAdministrationUnit.pas' , FunctionUnit in '..\Funktionsunits\FunctionUnit.pas';
{$R *.res}
procedure address_administration(appHandle: THandle); stdcall; begin if appHandle = 0 then apphandle := GetActiveWindow; Application.Handle := appHandle; try with TAddressAdministration.Create(Application) Do try ShowModal finally Free; end except On E: Exception Do Application.HandleException(E); end; Application.Handle := 0; end;
exports address_administration;
begin end. |
Kann mir da jemand weiterhelfen. Ich habe keine Ahnung, woran es liegt.