1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| procedure TPSScript.OnCompile(Sender: TPSScript);
procedure AddConst(const aName: AnsiString; aValue: cardinal; aType :AnsiString = 'LongInt');
begin
with Sender.Comp.AddConstant(aName, Sender.Comp.FindType(aType)) do
Value.tu32 := aValue;
end;
begin
Sender.Comp.AddTypeS('HWND', 'LongWord');
Sender.Comp.AddTypeS('UINT', 'LongWord');
AddConst('MB_OK', MB_OK);
AddConst('MB_OKCANCEL', MB_OKCANCEL);
AddConst('MB_ABORTRETRYIGNORE', MB_ABORTRETRYIGNORE);
AddConst('MB_YESNOCANCEL', MB_YESNOCANCEL);
AddConst('MB_YESNO', MB_YESNO);
AddConst('MB_RETRYCANCEL', MB_RETRYCANCEL);
AddConst('MB_ICONHAND', MB_ICONHAND);
AddConst('MB_ICONQUESTION', MB_ICONQUESTION);
AddConst('MB_ICONEXCLAMATION', MB_ICONEXCLAMATION);
AddConst('MB_ICONASTERISK', MB_ICONASTERISK);
AddConst('MB_USERICON', MB_USERICON);
AddConst('MB_ICONWARNING', MB_ICONEXCLAMATION);
AddConst('MB_ICONERROR', MB_ICONHAND);
AddConst('MB_ICONINFORMATION', MB_ICONASTERISK);
AddConst('MB_ICONSTOP', MB_ICONHAND);
AddConst('IDOK', IDOK);
AddConst('IDCANCEL', IDCANCEL);
AddConst('IDABORT', IDABORT);
AddConst('IDRETRY', IDRETRY);
AddConst('IDIGNORE', IDIGNORE);
AddConst('IDYES', IDYES);
AddConst('IDNO', IDNO);
AddConst('IDCLOSE', IDCLOSE);
Sender.AddFunctionEx(@MessageBox, 'function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: UINT): Integer;', cdStdCall);
end; |