Форум: "WinAPI";
Текущий архив: 2004.03.14;
Скачать: [xml.tar.bz2];
ВнизPomogite c Stop Watch Найти похожие ветки
← →
Mohamed (2004-01-07 00:12) [0]Uvajaemie mastera Delphi Pomogite pojaloista, vot uvas text pragramma
Ia khatchu delat sekundamer gde tam Start I Sbros (Button1Click:SetTimer, Button1Click:KillTimer);
Ashibka v (Button1Click:SetTimer и Button1Click:KillTimer);
Not enough actual parameters.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
ProgressBar1: TProgressBar;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Form1.Hide;
with ProgressBar1 do
Position:=Position+1;
if progressbar1.Position=100 then
Form1.Show;
//Tak i khotel zdes dobavit takoe functse chto bi pokazala na Caption u Label1
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Button1Click:SetTimer;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Button1Click:KillTimer;
end;
end.
← →
Delphi5.01 (2004-01-07 10:14) [1]Izvenite za pramotu, no vi zdes namudrili takoe chto mne ponadobilos 5 minut chtob ponat chto vi hoteli zdelat! Vot privoju kod programii, kotori po meemu vas i interesuet!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
TimerStop: Boolean; //ukazivaet rabotaet taimer ili ostanvlen
StartTime: Integer; //nachlnoe znachenie vremeni
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
StartTime:=GetTickCount; //procedura vozrashaet znachenie vremeni v milisekundax
//vrema kotoroe proshlo s zapuska kompa
TimerStop:=False; //a znachit zapuskaem timer
while Not TimerStop do
begin
form1.Caption:="Time: "+IntToStr(GetTickCount-StartTime); //vichislau skolko
//vremeni proshlo, i vivoju znachenie na ekran
Application.ProcessMessages; //nujen dla togo chtob proga ne zavisala
//proisxodilo obnovlenie
if Application.Terminated then //esli ktoto popitalsa otrubit programu
exit;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
TimerStop:=True; //ostanavlivau taimer
end;
end.
//no voobshe dla etoi celi ispolzovat Thread, i ne vkoem sluchee ne ispolzuite
//Timer, on daiot bolshie oshibki vo vremeni
Jelau udachi
Страницы: 1 вся ветка
Форум: "WinAPI";
Текущий архив: 2004.03.14;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.011 c