E
erqie
Unregistered / Unconfirmed
GUEST, unregistred user!
哪位大哥讲讲写dll给它传递不同类型参数的用法.包括传递数组,传递记录,传递动态数组,传递指针等.按照delphi自带的帮助讲dll的,那个
type
TTime=record
hour:Integer;
minute:Integer;
second:Integer;
end;
的记录,我随便写了一个过程:
procedure GetTime(var Time:TTime);stdcall;
begin
Time.hour:=1;
Time.minute:=2;
time.second:=100;
end;
在调用的时候
procedure TForm1.btn1Click(Sender: TObject);
type
TPro=procedure(var time:TTime);
var
han:THandle;
Pro:TPro;
ti:TTime;
begin
han:=LoadLibrary('project2.dll');
if han<>0 then
begin
@pro:=GetProcAddress(han,'GetTime');
Pro(ti);
ShowMessage('ti.second='+inttostr(ti.second));
FreeLibrary(han);
end;
end;
显示的总是一串数字.我需要怎么做才能使ti.second为100啊.
type
TTime=record
hour:Integer;
minute:Integer;
second:Integer;
end;
的记录,我随便写了一个过程:
procedure GetTime(var Time:TTime);stdcall;
begin
Time.hour:=1;
Time.minute:=2;
time.second:=100;
end;
在调用的时候
procedure TForm1.btn1Click(Sender: TObject);
type
TPro=procedure(var time:TTime);
var
han:THandle;
Pro:TPro;
ti:TTime;
begin
han:=LoadLibrary('project2.dll');
if han<>0 then
begin
@pro:=GetProcAddress(han,'GetTime');
Pro(ti);
ShowMessage('ti.second='+inttostr(ti.second));
FreeLibrary(han);
end;
end;
显示的总是一串数字.我需要怎么做才能使ti.second为100啊.