如何调用C++写的动态链接库.dll ( 积分: 50 )

  • 主题发起人 主题发起人 tilun
  • 开始时间 开始时间
T

tilun

Unregistered / Unconfirmed
GUEST, unregistred user!

Unsigned int WinApi Export CommInit(Unsigned char *Ip,Unsigned int Port,Unsigned char *spId,Unsigned int key);
用delphi 如何写.?
 

Unsigned int WinApi Export CommInit(Unsigned char *Ip,Unsigned int Port,Unsigned char *spId,Unsigned int key);
用delphi 如何写.?
 
TVsppCommInit=function(Ip:Pchar;nPort:Dword;SpId:pchar;key:Dword):Dword;stdcall;
PVsppCommInit=^TVsppCommInit;

var
Handle:THandle;
VsppCommInit_num:TVsppcommInit;
VsppCommInit_Add:^TVsppCommInit;
Dll_path:string;
begin

statusbar1.Panels[1].Text:='Á¬½ÓÍø¹Ø³É¹¦!';
memo1.Lines.Add('Á¬½ÓÍø¹Ø³É¹¦');
Dll_path:=extractfilepath(application.ExeName)+'SpServer.dll';
Handle:=Loadlibrary(Pchar(Dll_Path));
if Handle<>0 then
begin
@VsppCommInit_num:=GetProcAddress(Handle,'VsppCommInit');
VsppCommInit_Add:=@VsppCommInit_num;
if VsppCommInit_Add<>nil then
VsppCommInit_num(Pchar(Client_record.Ip),Client_record.Port,Pchar(Client_record.SpId),Client_record.MD5)
else
statusbar1.Panels[0].Text:='°ó¶¨Ê§°Ü!';
end
else
showmessage('µ÷ÓÃ.Dll¿âʧ°Ü!');
Freelibrary(Handle);
不能调用时边的api函数.即VsppCommInit_Add=nil 值.
搞了大半天了,晕死了。。
我自己在delphi 做了个动态链接库. 能正常调用. 哪位大侠帮我指点呐.
 

Similar threads

I
回复
0
查看
415
import
I
D
回复
0
查看
1K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部