Link to home
Start Free TrialLog in
Avatar of trunin
trunin

asked on

DLL

How can I create dll's and then use them in VB?
Avatar of DrDelphi
DrDelphi

I have a simple example on my website:

http://www.drdelphi.com/delphi/right/tips/dll.htm

Good luck!!
Avatar of trunin

ASKER

And how can I use dll in VB? I need a simple example of using delphi dll in VB.
In a module type something like:

Public Declare Function DelphiFunc Lib "MyDelphiDLL.dll" (ByVal TestInt As Long) As Long

or for a procedure:

Public Declare Sub DelphiProc Lib "MyDelphiDLL.dll" (ByVal TestStr As String)

Your Delphi DLL unit would look something like:


library MyDelphiDLL;

...
....

uses Windows;
...
...

function DelphiFunc(TestInt: integer): integer;
begin
  Result := TestInt * 2;
end;

procedure DelphiProc(TestStr: PChar);
begin
  MessageBox(Application.Handle,TestStr,'DelphiProc', MB_OK or MB_APPMODAL);
end;

...
...

exports DelphiFunc, DelphiProc;
ASKER CERTIFIED SOLUTION
Avatar of DrDelphi
DrDelphi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial