Delphi / Pascal和VB(.NET)互操作性

时间:2019-05-23 11:21:05

标签: vb.net delphi dll com interop

我有一个程序,可以在.dll之类的程序中调用Start函数

Start(ExePath + '\a.dll', @Start, True);

原始dll中的功能:

function Start(AppHandle: Cardinal; PProc: Pointer): Cardinal; stdcall;
begin
  @_Proc := Pointer(pproc);
  Application.Handle := AppHandle;
  Form1 := TForm1.Create(Application);
  AppLoaded := True;
  Result := 1;
  // Shows form by pressing a button inside the program
end;

两者都是用Delphi / Pascal编写的。理想情况下,我想在VB中使用.dll而不是Delphi / Pascal来调用.dll中的Start函数,但是由于dll与程序相互通信,因此应理解用Delphi / Pascal编写的程序VB代码。

https://forum.lazarus.freepascal.org/index.php/topic,45485.0.html

http://wiki.freepascal.org/Using_Pascal_Libraries_with_.NET_and_Mono#A_simple_VB.NET_app

理想情况下,我想用VB编写的原始dll替换该dll,并在程序调用时替换

Start(ExePath + '\a.dll', @Start, True);

VB功能

Public Shared Function Start(ByVal X As Integer...) As Long
End Function
应该调用

并应与Delphi / Pascal代码进行交互。或者,如果无法实现,我正在考虑与2个dll通信,例如,该程序将调用原始dll的功能,而该dll将依次调用VB dll的相应功能(“程序-> P.dll” -> VB.dll),但VB代码将无法与该程序进行交互。

The way it works (Program <-> D/P dll)
The way I want it to work *Direct way (Program <-> VB dll)
OR *Indirect way (Program -> D/P dll -> VB dll)

如何使用我的VB代码?更具体地说,哪种方式(直接,间接)是可能的,以及如何使其起作用? 任何帮助表示赞赏。

0 个答案:

没有答案