Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi LPDISPATCH über DLL-Schnittstelle in Exe verwenden (https://www.delphipraxis.net/58409-lpdispatch-ueber-dll-schnittstelle-exe-verwenden.html)

Bernhard Geyer 6. Dez 2005 16:58


LPDISPATCH über DLL-Schnittstelle in Exe verwenden
 
ch habe eine C/C++-Dll mit C-Interface und will von diesem eine LPDISPATCH-Interface-Zeiger zurückbekommen.

Die Funktion binde ich in Delphi mittels

MyDLLFunc: function( Parent: HWND): Pointer; stdcall;

und bekomme mittels
Delphi-Quellcode:
var
  pDisp: pDispatch;
  Disp: IDispatch;
begin
  pDisp := pDispatch(MyDLLFunc);
  Disp := pDisp^;
end;
Auch bis zum punkt pDisp := ...,
aber bei Disp := ... kracht es.

Was muß ich noch beachten? Evtl. irgendwelches Marshalling?

shmia 6. Dez 2005 18:17

Re: LPDISPATCH über DLL-Schnittstelle in Exe verwenden
 
Versuch mal:
Delphi-Quellcode:
var
  Disp: IDispatch;
  obj : OleVariant;
begin
  Disp := IDispatch(MyDLLFunc);
  obj := Disp;
  obj.SomeMethod;
end;

Bernhard Geyer 7. Dez 2005 07:56

Re: LPDISPATCH über DLL-Schnittstelle in Exe verwenden
 
Wieso sieht man manchmal die einfachste Lösung nicht? :wall:


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:40 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz