Hello,
I'am trying to add GetCursorPos function to scripter but I have a problem, as always after a long time I don't handle record in scripter.
So I try this :
procedure TForm1._GetCursorPos(AMachine: TatVirtualMachine);
var
Param0: TPoint;
AResult:boolean;
begin
AResult := GetCursorPos(Param0);
AMachine.ReturnOutputArg(AResult);
AMachine.SetInputArg(0,NativeUInt(TPointWrapper.Create(Param0)));
end;
TPointWrapper is defined in Ap_types.pas :
TPointWrapper = class(TatRecordWrapper)
private
FX: Longint;
FY: Longint;
public
constructor Create(ARecord: TPoint);
function ObjToRec: TPoint;
published
property X: Longint read FX write FX;
property Y: Longint read FY write FY;
end;
Added with :
atPascalScripter.SystemLibrary.defineMethod('GetCursorPos',1,atScript.tkInteger,nil,_GetCursorPos);
This script
var
p:tpoint;
begin
GetCursorPos(P);
ShowMessage(P.x);
end;
return this error :
"RUNTIME ERROR Method expects argument 0 as variable reference Position: 4, 17.":