TpaxScripter Demo. PAX Time.
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "PaxScripter"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
PaxScripter1->Run(rmRun, "", 0);
}
//---------------------------------------------------------------------------
AnsiString GetStrTime() {
return DateTimeToStr(Now());
}
void __fastcall TForm1::PaxScripter1AssignScript(TPaxScripter *Sender)
{
RegisterRoutine("function GetStrTime(): String; cdecl;", GetStrTime, -1);
Sender->AddModule("main", paxBasic);
Sender->AddCodeFromFile("main", "script.txt");
}
//---------------------------------------------------------------------------
script.txt
Imports SysUtils, ExtCtrls, Forms
Dim Form = New TForm(NULL)
Form.Caption = "PAX Time"
Form.Canvas.Font.Height = 50
Dim Timer = New TTimer(Form)
Timer.Interval = 100
Timer.OnTimer = AddressOf ShowTime
Form.Show
Sub ShowTime(Sender)
Form.Canvas.TextOut 10, 10, GetStrTime()
End Sub
Copyright © 1999-2008
VIRT Laboratory. All rights reserved.