unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Form2:=TForm2.Create(Application);
form2.listbox1.visible:=false;
form2.Button1.Visible:=false;
form2.Button2.Visible:=false;
form2.Button3.Visible:=false;
Form2.Visible:=true;
end;
end.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, inifiles, ShellAPI;
type
TForm2 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
ComboBox1: TComboBox;
Label1: TLabel;
procedure ComboBox1Change(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.ComboBox1Change(Sender: TObject);
var
Ini: Tinifile;
begin
if combobox1.ItemIndex=0 then begin
Button1.Visible:=false;
Button2.Visible:=false;
Button3.Visible:=false;
// открываем файл myini.ini
ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
listbox1.Height:=Ini.ReadInteger('Size','Height',100);
listbox1.Left:=Ini.ReadInteger('Size','Left',10);
listbox1.Visible:=true;
end;
if combobox1.ItemIndex=1 then begin
listbox1.visible:=false;
ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
button1.Height:=Ini.ReadInteger('Size1','Height',100);
button1.Left:=Ini.ReadInteger('Size1','Left',10);
button1.Visible:=true;
button2.Height:=Ini.ReadInteger('Size2','Height',100);
button2.Left:=Ini.ReadInteger('Size2','Left',10);
button2.Top:=ini.ReadInteger('Size2','Top',10);
button2.Visible:=true;
button3.Height:=Ini.ReadInteger('Size3','Height',100);
button3.Left:=Ini.ReadInteger('Size3','Left',10);
button3.Top:=ini.ReadInteger('Size3','Top',10);
button3.Visible:=true;
end;
end;
procedure TForm2.ListBox1Click(Sender: TObject);
var
ini:tinifile;
f:string;
begin
if listbox1.ItemIndex=0 then begin
ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
f:=Ini.ReadString('Paint','Open','Value1');
WinExec(PChar(f),SW_ShowNormal);
end;
if listbox1.ItemIndex=1 then begin
ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
f:=Ini.ReadString('WordPad','Open','Value1');
WinExec(PChar(f),SW_ShowNormal);
end;
if listbox1.ItemIndex=2 then begin
ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
f:=Ini.ReadString('Kalc','Open','Value1');
WinExec(PChar(f),SW_ShowNormal);
end;
end;
procedure TForm2.Button1Click(Sender: TObject);
var
ini:tinifile;
f:string;
begin
ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
f:=Ini.ReadString('Paint','Open','Value1');
WinExec(PChar(f),SW_ShowNormal);
end;
procedure TForm2.Button2Click(Sender: TObject);
var
ini:tinifile;
f:string;
begin
ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
f:=Ini.ReadString('WordPad','Open','Value1');
WinExec(PChar(f),SW_ShowNormal);
end;
procedure TForm2.Button3Click(Sender: TObject);
var
ini:tinifile;
f:string;
begin
ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
f:=Ini.ReadString('Kalc','Open','Value1');
WinExec(PChar(f),SW_ShowNormal);
end;
end.