trunin
asked on
DLL
How can I create dll's and then use them in VB?
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.Han dle,TestSt r,'DelphiP roc', MB_OK or MB_APPMODAL);
end;
...
...
exports DelphiFunc, DelphiProc;
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.Han
end;
...
...
exports DelphiFunc, DelphiProc;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.drdelphi.com/delphi/right/tips/dll.htm
Good luck!!