
14.11.2009, 22:35
|
Прохожий
|
|
Регистрация: 28.06.2009
Сообщения: 37
Репутация: 10
|
|
Попробовал "a" сделать word, все равно та же проблема...при ошибке различные числа вылетают((( Вот код формы:
Код:
private
{ Private declarations }
public
function ReadIni(ASection, AString : String) : String;
procedure WriteIni(ASection, AString, AValue : String);
function poisk(a:word):boolean;
procedure ZM;
procedure vopros(a:word);
procedure PR;
procedure record_in_file;
{ Public declarations }
end;
var
Form7: TForm7;
i:integer;
famili,group:string;
Spisok:array of byte;
sch:byte;
vern:byte;
kol:byte;
TimeOut:boolean;
f:TextFile;
flag: boolean;
nevern:byte;
a: string;
implementation
uses Unit2, Unit5, Math;
{$R *.dfm}
procedure TForm7.FormCreate(Sender: TObject);
begin
i:=0;
ProgressBar1.Position:=0;
end;
end;
procedure TForm7.FormShow(Sender: TObject);
begin
i:=0;
ProgressBar1.Position:=0;
end;
procedure TForm7.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
Application.ProcessMessages;
end;
procedure TForm7.Timer1Timer(Sender: TObject);
begin
ProgressBar1.Position:=ProgressBar1.Position+1;
if ProgressBar1.Position=ProgressBar1.Max then
begin
Timer1.Enabled:=false;
TimeOut:=true;
PR;
end;
end;
procedure TForm7.Button2Click(Sender: TObject);
begin
Randomize;
Form7.Caption:=inttostr(random(146));
end;
function TForm7.ReadIni(ASection, AString: String): String;
var
sIniFile: TIniFile;
sPath: String[60];
begin
GetDir(0,sPath);
sIniFile := TIniFile.Create(sPath + '\Cfg3.INI');
result:=sIniFile.ReadString(ASection, AString,'00000000');
sIniFile.Free;
end;
procedure TForm7.WriteIni(ASection, AString, AValue: String);
var
sIniFile: TIniFile;
sPath: String[60];
begin
GetDir(0,sPath);
sIniFile := TIniFile.Create(sPath + '\Cfg3.INI');
sIniFile.WriteString(ASection, AString, AValue);
sIniFile.Free;
end;
procedure TForm7.Button5Click(Sender: TObject);
begin
SpeedButton3.visible := true;
ProgressBar1.Max:=Form2.SpinEdit7.Value*60;
ProgressBar1.Position:=0;
Timer1.Enabled:=true;
Label3.Visible:=false;
Label4.Visible:=false;
Edit1.Visible:=false;
Edit2.Visible:=false;
Button5.Visible:=false;
SpeedButton1.visible:=false;
kol:=Form2.SpinEdit6.Value;
ZM;
if Edit1.Text<>'' then famili:= Edit1.Text else famili:= 'не указана';
if Edit2.Text<>'' then group:=Edit2.Text else group:= 'не указана';
Label1.Visible:=true;
Memo1.Visible:=true;
RadioGroup1.Visible:=true;
ProgressBar1.Visible:=true;
sch:=0;
vern:=0;
nevern:=0;
vopros(spisok[0]);
AssignFile(f,'c:\program files\result\'+famili+'_'+group+'.txt');
rewrite(f);
CloseFile(f);
flag:=true;
end;
function TForm7.poisk(a: word):boolean;
var
i,f:byte;
begin
f:=0;
for i:=0 to length(Spisok)-1 do
if a=Spisok[i] then inc(f);
if f>0 then Result:=true else Result:=false;
end;
procedure TForm7.Timer2Timer(Sender: TObject);
var
// sIniFile: TIniFile;
sPath: String[60];
begin
GetDir(0,sPath);
if FileExists(sPath + '\Cfg3.INI') then
begin
Timer2.Enabled:=false;
form2.SpinEdit6.Value:=strtoint(Form7.ReadIni('all','kolv'));
form2.SpinEdit7.Value:=strtoint(Form7.ReadIni('all','kolm'));
form2.SpinEdit8.Value:=strtoint(Form7.ReadIni('all','5'));
form2.SpinEdit9.Value:=strtoint(Form7.ReadIni('all','4'));
form2.SpinEdit10.Value:=strtoint(Form7.ReadIni('all','3'));
end
else
Begin
Timer2.Enabled:=false;
ShowMessage('файл конфигурации не создан, перейдите в меню настроек');
end
end;
__________________
"I remember the good old days, when computers were
mainframes, analysts were magicians,and programmers
punced cards..."
|