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

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 做了个动态链接库. 能正常调用. 哪位大侠帮我指点呐.
 
顶部