Разработка технологии создания дистанционных курсов на примере курса "Администрирование DB2", страница 53

 FConnectionCount:=ConCnt;

 Label3.Caption:=IntToStr(FConnectionCount);

end;

procedure TMainForm.FormShow(Sender: TObject);

begin

 MainForm.StringGrid1.Cells[0,0]:='Логин';

 MainForm.StringGrid1.Cells[1,0]:='Время установления соединения';

 MainForm.StringGrid1.Cells[2,0]:='Прошло времени';

end;

procedure TMainForm.Timer1Timer(Sender: TObject);

var i:LongWord;

begin

 if FConnectionCount>0 then

  for i:=StringGrid1.RowCount-1 to 1 do

   try

    StringGrid1.Cells[2,i]:=TimeToStr(StrToDateTime(StringGrid1.Cells[1,i])-Now);

   except on e:Exception do;

   end;

end;

Procedure TMainForm.WndProc(Var Msg:TMessage);

Begin

  Case Msg.Msg of

    WM_SYSCOMMAND:

     begin

       if Msg.WParam=SC_MINIMIZE then begin

         Hide;

         TrayForm.Act;

         exit;

       end;

     end;

  end { Case };

  Inherited

End;

procedure TMainForm.Panel1Resize(Sender: TObject);

begin

 Label1.Left:=(Panel1.Width-Label1.Width) div 2;

end;

procedure TMainForm.Panel2Resize(Sender: TObject);

begin

 Label4.Left:=Panel2.Width-Label4.Width-5;

end;

procedure TMainForm.FormCreate(Sender: TObject);

var constr:string;

begin

 MyRegFile:=TRegIniFile.Create(strRegIni);

 constr:=MyRegFile.ReadString(strRegFolder,strRegCon,'');

 if constr='' then MyRegFile.WriteString(strRegFolder,strRegCon,DefConStr);

end;

procedure TMainForm.SpeedButton1Click(Sender: TObject);

begin

 ConStrForm.Show;

end;

end.

unit tray;

interface

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs,ShellAPI;

type

  TTrayForm = class(TForm)

  private

    FIconData:TNotifyIconData;

  protected

    Procedure WndProc(Var Msg:TMessage); Override;

  public

    procedure Act;

  end;

var

  TrayForm: TTrayForm;

implementation

uses main;

{$R *.dfm}

Procedure TTrayForm.WndProc(Var Msg:TMessage);

Var P:TPoint;

Begin

  If Msg.Msg=WM_USER+1

     then Case Msg.lParam of

            WM_LBUTTONDOWN:

               begin

                 Shell_NotifyIcon(NIM_DELETE,@FIconData);

                 MainForm.Show;

               end;

           end { Case };

  Inherited

End;

procedure TTrayForm.Act;

begin

With FIconData do

  begin

    cbSize:=SizeOf(FIconData);

    Wnd:=Handle;

    uID:=100;

    uFlags:=NIF_MESSAGE+NIF_ICON+NIF_TIP;

    uCallbackMessage:=WM_USER+1;

    hIcon:=Application.Icon.Handle;

    StrPCopy(szTip,Application.Title)

  end;

 Shell_NotifyIcon(NIM_ADD,@FIconData);

end;

end.

unit ConStrUnit;

interface

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, StdCtrls, Buttons;

type

  TConStrForm = class(TForm)

    Label1: TLabel;

    Memo1: TMemo;

    BitBtn1: TBitBtn;

    BitBtn2: TBitBtn;

    procedure BitBtn1Click(Sender: TObject);

    procedure FormShow(Sender: TObject);

    procedure BitBtn2Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

var

  ConStrForm: TConStrForm;

implementation

uses main;

{$R *.dfm}

procedure TConStrForm.BitBtn1Click(Sender: TObject);

begin

 if Memo1.Modified then

  if MessageBox(Handle, 'Информация в строке соединения к БД была изменена. Сохранить изменения в реестре?','Внимание',MB_YESNO or MB_ICONQUESTION) = IDYES         then

   MainForm.MyRegFile.WriteString(strRegFolder,strRegCon,Memo1.Text);

 Hide;

end;

procedure TConStrForm.FormShow(Sender: TObject);

begin

 Memo1.Lines.Clear;

 Memo1.Lines.Add(MainForm.MyRegFile.ReadString(strRegFolder,strRegCon,''));

 Memo1.Modified:=false;

end;

procedure TConStrForm.BitBtn2Click(Sender: TObject);

begin

 Hide;

end;

end.

Управление процессом обучения

Default.htm

<html><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">

<HTML>

<HEAD><meta http-equiv="Content-Type" content="text/html; charset=windows-1251">

<TITLE>Введение в DB2</TITLE></HEAD>

<FRAMESET FRAMEBORDER=0 FRAMESPACING=0 cols="0,*" BORDER=NO MARGINHEIGHT=0 MARGINWIDTH=0>