nice tut thanks, but i can't get it to work,
when i make my form, then try to run it i get this error:
Successfully compiled
[Runtime Error] : Exception: Cannot make a visible window modal in line 28 in script
here's the code that i used
program New;
var
frmDesign : TForm;
UsernameLabel : TLabel;
Button1 : TButton;
TextBox1 : TEdit;
CheckBox1 : TCheckBox;
procedure SafeInitForm; // Default Code
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal; // Default Code
begin
frmDesign.ShowModal;
end;
procedure SafeShowFormModal; // Default Code
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v); // <--- this is line 28
end;
procedure ClickButton(sender: TObject); // Adding Buttons and Interactivity
begin
frmDesign.Caption:= frmDesign.Caption + '.';
frmDesign.ModalResult:= mrOk;
end;
Procedure AddPic; // Loading a Picture
var
Picture : integer;
Canvas : TCanvas;
begin
{Picture := LoadBitmap()}
Canvas:= GetBitmapCanvas(Picture);
CopyCanvas(Canvas, frmDesign.Canvas, 1, -1, 300, 520, 0, 0, 315, 520);
end;
Procedure FormPaintStar(Sender : TObject); // Adding a picture
begin
AddPic;
end;
Procedure InitForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 250;
frmDesign.Top := 114;
frmDesign.Width := 230;
frmDesign.Height := 157;
frmDesign.Caption := 'frmDesign';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := True;
frmDesign.PixelsPerInch := 96;
UsernameLabel := TLabel.Create(frmDesign);
UsernameLabel.Parent := frmDesign;
UsernameLabel.Left := 9;
UsernameLabel.Top := 23;
UsernameLabel.Width := 74;
UsernameLabel.Height := 20;
UsernameLabel.Hint := 'Username';
UsernameLabel.Caption := 'Username';
UsernameLabel.Font.Color := clWindowText;
UsernameLabel.Font.Height := -16;
UsernameLabel.Font.Name := 'MS Sans Serif';
UsernameLabel.Font.Style := [];
UsernameLabel.ParentFont := False;
UsernameLabel.ParentShowHint := False;
UsernameLabel.ShowHint := True;
Button1 := TButton.Create(frmDesign);
Button1.Parent := frmDesign;
Button1.Left := 117;
Button1.Top := 61;
Button1.Width := 75;
Button1.Height := 25;
Button1.Hint := 'Click here to start the script';
Button1.Caption := 'Start';
Button1.Font.Color := clWindowText;
Button1.Font.Height := -12;
Button1.Font.Name := 'MS Sans Serif';
Button1.Font.Style := [];
Button1.ParentFont := False;
Button1.ParentShowHint := False;
Button1.ShowHint := True;
Button1.TabOrder := 8;
TextBox1 := TEdit.Create(frmDesign);
TextBox1.Parent := frmDesign;
TextBox1.Left := 87;
TextBox1.Top := 24;
TextBox1.Width := 121;
TextBox1.Height := 21;
TextBox1.Hint := 'Type your username here';
TextBox1.ParentShowHint := False;
TextBox1.ShowHint := True;
TextBox1.TabOrder := 9;
CheckBox1 := TCheckBox.Create(frmDesign);
CheckBox1.Parent := frmDesign;
CheckBox1.Left := 37;
CheckBox1.Top := 67;
CheckBox1.Width := 74;
CheckBox1.Height := 17;
CheckBox1.Hint := 'Do you want antirandoms?';
CheckBox1.Caption := 'Antirandom';
CheckBox1.ParentShowHint := False;
CheckBox1.ShowHint := True;
CheckBox1.TabOrder := 11;
end;
begin
SafeInitForm; // Load and Show Forms
SafeShowFormModal;
// Main loop here
end.