1,183
社区成员
发帖
与我相关
我的任务
分享
我用delphi2010定义了一个结构体。
type
sthinfo = record
name: array[0..$20] of pansichar;
id : dword;
type: dword;
end;
Psthinfo = ^sthinfo;
var DllHandle:THandle;
Pro:Procedure (mon:Psthinfo); cdecl;
i:integer;
sth:array[0..3] of sthinfo;
begin
DllHandle := LoadLibrary('DelphiDll.Dll');
if DllHandle<>0 then
begin
@Pro := GetProcAddress(DllHandle,pchar('Getsthinfo'));
Pro(@sth);
for I := 0 to 2 do
begin
showmessage(mon[i].name);
Showmessage(inttohex(mon[i].id,4));
Showmessage(inttohex(mon[i].m_type,4));
end;
end;
end;
typedef struct _sthinfo
{
DWORD id;
DWORD type;
char name[0x20];
}sthinfo;
void GetMoninfo(sthinfo *sth)
{
sth[0].id = 1;
strncpy(sth[0].name,"1号",0x20);
sth[0].type = 0x1f;
sth[1].id = 2;
strncpy(sth[1].name,"2号",0x20);
sth[1].type = 0x2f;
sth[2].id = 3;
strncpy(sth[2].name,"3号",0x20);
sth].type = 0x3f;
return ;
};