klinux书籍的配套光盘。可以学习学习。

源代码在线查看: 列表5.12.txt

软件大小: 62 K
上传用户: villyc
关键词: klinux 书籍 光盘
下载地址: 免注册下载 普通下载 VIP

相关代码

				【列表5.12】Sleeper程序代码。
				{
				   frmSleeper - Demonstrate the sleep() library function
				}
				unit frmSleeper;
				interface
				uses
				   SysUtils, Types, Classes, QGraphics, QControls, QForms, QDialogs,
				   QExtCtrls, QStdCtrls, Libc;
				 type
				    TSleeperMainForm = class(TForm)
				       ExitBtn: TButton;
				       StartBtn: TButton;
				       SleepMemo: TMemo;
				       TimerMemo: TMemo;
				       Timer: TTimer;
				       procedure SleepySye;
				       procedure ExitBtnClick(Sender: TObject);
				        procedure StartBtnClick(Sender: TObject);
				        procedure TimerTimer(Sender: TObject);
				     private
				        { Private declarations }
				     public
				        { Public declarations }
				     end;
				  var
				     SleeperMainForm: TSleeperMainForm;
				   implementation
				   {SR *.xfm}
				   procedure TSleeperMainForm. SleePyBye;
				   var
				     i : Integer;
				     s : String;
				   begin
				     Timer. Enabled := True;
				     SleepMemo.Clear;
				     TimerMemo.Clear;
				     s := 'Start... ';
				     SleepMemo,Text :=s;
				for i :=1 to 4 do
				  begin
				   Application.ProcessMessages;
				   __Sleep(5);
				    s := s + IntToStr(i * 5);
				    if  i 				     then s  := s + '...  '
				     else s  := s + '!';
				    SleepMemo.Text := s;
				  end; { for }
				end;
				procedure TSleeperMainForm. ExitBtnClick(Sender: TObject);
				begin
				 Close;
				end;
				procedure TSleeperMainForm. StartBtnClick(Sender: TObject);
				begin
				  SleepyBye;
				end;
				procedure TSleeperMainForm.TimerTimer(Sender: TObject);
				begin
				  Timer. Enabled := False;
				  TimerMemo.Text := 'The 12-second timer has fired!';
				 end;
				 end.
							

相关资源