Z
zhang12345
Unregistered / Unconfirmed
GUEST, unregistred user!
type
TOnError = procedure(aErrorID: integer; aErrorMsg: shortstring) of object; stdcall;
procedure Test.TestOnError(aErrorID: integer; aErrorMsg: shortstring); stdcall;
begin
Showmessage(aErrorMsg);
end;
procedure Test.aa;
var
TmpOnError: TOnError;
TmpOnError1: TOnError;
pp: pointer;
pOnError: ^TOnError;
begin
TmpOnError := TestOnError;
TmpOnError(1, '2'); //执行正常
pOnError := @TmpOnError;
TmpOnError1 := pOnError^;
TmpOnError1(11, '2'); //出现access violation 错误
end;
以上程序是把我的程序简化后的,请说明出错原因及解决办法,谢谢!
TOnError = procedure(aErrorID: integer; aErrorMsg: shortstring) of object; stdcall;
procedure Test.TestOnError(aErrorID: integer; aErrorMsg: shortstring); stdcall;
begin
Showmessage(aErrorMsg);
end;
procedure Test.aa;
var
TmpOnError: TOnError;
TmpOnError1: TOnError;
pp: pointer;
pOnError: ^TOnError;
begin
TmpOnError := TestOnError;
TmpOnError(1, '2'); //执行正常
pOnError := @TmpOnError;
TmpOnError1 := pOnError^;
TmpOnError1(11, '2'); //出现access violation 错误
end;
以上程序是把我的程序简化后的,请说明出错原因及解决办法,谢谢!