5,388
社区成员
发帖
与我相关
我的任务
分享
tmyclass=class
private
public
procedure proc(i:integer;myclass1:tmyclass);
end;
procedure tmyclass.proc(i:integer;myclass1:tmyclass);
begin
func(i,aaa);
end;
function TMyClass.aaa: boolean;
type mypointer = function(i: integer; xxx: TMyClass): boolean; stdcall;
var
XHandle: Thandle;
frm_p: mypointer;
i: integer;
begin
result := false;
XHandle := loadlibrary('DllA.dll');
if XHandle > 32 then
try
frm_p := GetProcAddress(XHandle, 'Func');
result := frm_p(0, xxx); /// 此处类型错误 xxx extended
finally
freelibrary(XHandle);
end;
end;
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
tmyclass=class
private
k: integer;
public
procedure proc(i:integer;myclass1:tmyclass);
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
c:tmyclass;
begin
c:=tmyclass.Create;
try
c.k:=100;
c.proc(1, c);
finally
c.Free;
end;
end;
{ tmyclass }
procedure tmyclass.proc(i: integer; myclass1: tmyclass);
begin
ShowMessage(inttostr(i)+#13#10+inttostr(Myclass1.k));
end;
end.