A
A
Anton2019-06-02 14:38:56
Delphi
Anton, 2019-06-02 14:38:56

Why won't the compiled exe run?

I got someone else's working project. I want to remake it. When I compile the project it compiles fine but doesn't run. Generally. Nothing happens, only the cursor "blinks" a couple of times. There was already a compiled working exe in the project folder, but it doesn't work for me.
What can be done?

Full code
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Menus, Buttons;

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    Panel1: TPanel;
    PopupMenu1: TPopupMenu;
    ComboBox1: TComboBox;
    RadioGroup1: TRadioGroup;
    Edit1: TEdit;
    Memo1: TMemo;
    RadioGroup2: TRadioGroup;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    ListBox1: TListBox;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    ScrollBar1: TScrollBar;
    BitBtn1: TBitBtn;
    N1: TMenuItem;
    Color1: TMenuItem;
    MEMO2: TMenuItem;
    Fonr1: TMenuItem;
    Example1: TMenuItem;
    N2: TMenuItem;
    Color2: TMenuItem;
    MEMO3: TMenuItem;
    Font1: TMenuItem;
    Example2: TMenuItem;
    N3: TMenuItem;
    N4: TMenuItem;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure ScrollBar1Change(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Color2Click(Sender: TObject);
    procedure MEMO3Click(Sender: TObject);
    procedure Font1Click(Sender: TObject);
    procedure N4Click(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
if (RadioGroup1.ItemIndex=0) then
Form1.Color:=clGreen;
if (RadioGroup1.ItemIndex=1) then
Form1.Color:=clBlue;
if (RadioGroup1.ItemIndex=2) then
Form1.Color:=clRed;
if (RadioGroup2.ItemIndex=0) then
Memo1.Color:=clBlue;
if (RadioGroup2.ItemIndex=1) then
Memo1.Color:=clGreen;
if (RadioGroup2.ItemIndex=2) then
Memo1.Color:=clRed;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if (ComboBox1.Text<>'') or (Edit1.Text<>'') then  Memo1.Clear;
if (ComboBox1.Text<>'') then
begin
Memo1.Lines.Add(ComboBox1.Text);
end;
if (Edit1.Text<>'') then
begin
Memo1.Lines.Add(Edit1.Text);
end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
if (CheckBox1.Checked) then
Memo1.Font.Color:=clRed
else
Memo1.Font.Color:=clWindowText;
if (CheckBox2.Checked) then
Memo1.Font.Style:=[fsItalic]
else
Memo1.Font.Style:=[];
 if (CheckBox2.Checked) then
RadioGroup1.Font.Style:=[fsItalic]
else
RadioGroup1.Font.Style:=[];
if (CheckBox2.Checked) then
RadioGroup2.Font.Style:=[fsItalic]
else
RadioGroup2.Font.Style:=[];
if (CheckBox2.Checked) then
Button1.Font.Style:=[fsItalic]
else
Button1.Font.Style:=[];
if (CheckBox2.Checked) then
Button2.Font.Style:=[fsItalic]
else
Button2.Font.Style:=[];
if (CheckBox2.Checked) then
Button3.Font.Style:=[fsItalic]
else
Button3.Font.Style:=[];
if (CheckBox2.Checked) then
Button4.Font.Style:=[fsItalic]
else
Button4.Font.Style:=[];


end;

procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
if (ScrollBar1.Position=1) then
Form1.Color:=clyellow;
if (ScrollBar1.Position=2) then
Form1.Color:=clblack;
if (ScrollBar1.Position=3) then
Form1.Color:=clgray;
if (ScrollBar1.Position=4) then
Form1.Color:=clGreen;
if (ScrollBar1.Position=5) then
Form1.Color:=clBlue;
if (ScrollBar1.Position=6) then
Form1.Color:=clRed;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
if (Edit1.Text<>'') then
begin
ListBox1.Items.Add(Edit1.Text);
end;
end;

procedure TForm1.Color2Click(Sender: TObject);
begin
if (RadioGroup1.ItemIndex=0) then
Form1.Color:=clGreen;
if (RadioGroup1.ItemIndex=1) then
Form1.Color:=clBlue;
if (RadioGroup1.ItemIndex=2) then
Form1.Color:=clRed;
if (RadioGroup2.ItemIndex=0) then
Memo1.Color:=clBlue;
if (RadioGroup2.ItemIndex=1) then
Memo1.Color:=clGreen;
if (RadioGroup2.ItemIndex=2) then
Memo1.Color:=clRed;
end;

procedure TForm1.MEMO3Click(Sender: TObject);
begin
if (ComboBox1.Text<>'') or (Edit1.Text<>'') then  Memo1.Clear;
if (ComboBox1.Text<>'') then
begin
Memo1.Lines.Add(ComboBox1.Text);
end;
if (Edit1.Text<>'') then
begin
Memo1.Lines.Add(Edit1.Text);
end;
end;

procedure TForm1.Font1Click(Sender: TObject);
begin
if (CheckBox1.Checked) then
Memo1.Font.Color:=clRed
else
Memo1.Font.Color:=clWindowText;
if (CheckBox2.Checked) then
Memo1.Font.Style:=[fsItalic]
else
Memo1.Font.Style:=[];
 if (CheckBox2.Checked) then
RadioGroup1.Font.Style:=[fsItalic]
else
RadioGroup1.Font.Style:=[];
if (CheckBox2.Checked) then
RadioGroup2.Font.Style:=[fsItalic]
else
RadioGroup2.Font.Style:=[];
if (CheckBox2.Checked) then
Button1.Font.Style:=[fsItalic]
else
Button1.Font.Style:=[];
if (CheckBox2.Checked) then
Button2.Font.Style:=[fsItalic]
else
Button2.Font.Style:=[];
if (CheckBox2.Checked) then
Button3.Font.Style:=[fsItalic]
else
Button3.Font.Style:=[];
if (CheckBox2.Checked) then
Button4.Font.Style:=[fsItalic]
else
Button4.Font.Style:=[];


end;

procedure TForm1.N4Click(Sender: TObject);
begin
MessageDlg('Лабораторная работа, Сорокин А.А.', mtInformation, [mbOK], 0);
end;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Tsvetkov, 2019-06-02
@tsklab

Full code
The project file itself (DPR) is also needed. There is a suspicion that the main form is not defined. (And there is).
MyProgram.dprshould be like this:
program MyProgram;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question