home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 March
/
Chip_2002-03_cd1.bin
/
zkuste
/
delphi
/
nastroje
/
d23456
/
PRODEL.ZIP
/
PROFONLC.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
2001-05-05
|
4KB
|
183 lines
//PROFILE-NO
unit Profonlc;
interface
uses
Windows,
QForms, QControls, QStdCtrls,
Classes,
SysUtils;
{$H-}
{$V-}
{$O-}
{$D-}
{$B-}
{$Q-}
{$I-}
{$R-}
{$A+}
{$W+}
{$J+}
{$T+}
{$X+}
PROCEDURE ProfOnlineOperation;
TYPE
TOnlineProform = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Edit1: TEdit;
GroupBox1: TGroupBox;
Button4: TButton;
procedure StarteMessung(Sender: TObject);
procedure StoppeMessung(Sender: TObject);
procedure Anhaengen(Sender: TObject);
procedure Erzeugen(Sender: TObject);
procedure ResultatLoeschen(Sender: TObject);
procedure Zerstoeren(Sender: TObject);
private
{ Private-Deklarationen }
procedure ButtonOnOff;
public
{ Public-Deklarationen }
IstAktiv : Boolean;
end;
var
OnlineProform: TOnlineProform;
{$R *.xfm}
IMPLEMENTATION
USES
IniFiles,
Profint;
FUNCTION GetMHZ85 : Integer; external 'PROFMEAS.DLL';
FUNCTION ProfIstAktiv : Boolean; external 'PROFMEAS.DLL';
PROCEDURE ProfResultatLoeschen; external 'PROFMEAS.DLL';
VAR
winxpos : Integer;
winypos : Integer;
toppos : Integer;
PROCEDURE ProfOnlineOperation;
VAR
hs : String;
BEGIN
Application.CreateForm(TOnlineProForm, OnlineProForm);
OnLineProForm.Caption := 'ProDelphi - online operation';
Str(GetMHz85,hs);
OnlineProForm.Edit1.text := 'CPU performs with ' + hs + ' MHz';
END;
FUNCTION GetIniFile : String;
BEGIN
Result := ExtractFilePath(ParamStr(0)) + 'profile.ini';
END;
procedure TOnlineProform.StarteMessung(Sender: TObject);
begin
ProfActivate;
ButtonOnOff;
end;
procedure TOnlineProform.StoppeMessung(Sender: TObject);
begin
ProfDeactivate;
ButtonOnOff;
end;
procedure TOnlineProform.Anhaengen(Sender: TObject);
VAR
txt : Array[0..255] OF Char;
begin
StrPLCopy(txt, OnlineProForm.Edit1.Text, 255);
ProfSetComment(txt);
ProfAppendResults(FALSE);
end;
procedure TOnlineProform.Erzeugen(Sender: TObject);
begin
IF winxpos <> -1 THEN BEGIN
Left := winxpos;
Top := Winypos;
END;
IF TopPos <> 0 THEN
FormStyle := fsStayOnTop;
ButtonOnOff;
end;
procedure TOnlineProform.ButtonOnOff;
begin
IF ProfIstAktiv = TRUE THEN BEGIN
Button1.Enabled := FALSE;
Button2.Enabled := TRUE;
END
ELSE BEGIN
Button2.Enabled := FALSE;
Button1.Enabled := TRUE;
END;
end;
procedure TOnlineProform.ResultatLoeschen(Sender: TObject);
BEGIN
ProfResultatLoeschen;
end;
PROCEDURE IntWritePrivateProfileString( CONST absch, key, wert, pf : String );
VAR
Ini : TIniFile;
BEGIN
Ini := TIniFile.Create( pf );
Ini.WriteString(absch, key, wert);
Ini.UpdateFile;
Ini.Free;
END;
procedure TOnlineProform.Zerstoeren(Sender: TObject);
VAR
xp, yp : String;
begin
Str(top, yp);
Str(left, xp);
IntWritePrivateProfileString('PROFILER', 'SCREEN-X' ,xp, GetIniFile);
IntWritePrivateProfileString('PROFILER', 'SCREEN-Y' ,xp, GetIniFile);
END;
PROCEDURE IntGetPrivateProfileString(CONST absch, key, VB : String;
VAR Buffer : String;
CONST pf : String );
var
Ini : TIniFile;
begin
Ini := TIniFile.Create(pf);
buffer := Ini.ReadString(absch, key, vb);
Ini.Free;
END;
PROCEDURE InitUnit;
VAR
buff : String;
anzeige : Integer;
BEGIN
IntGetPrivateProfileString('PROFILER','SCREEN-X', '-1', buff, GetIniFile);
VAL(buff, winxpos, anzeige);
IF anzeige <> 0 THEN
Winxpos := -1;
IntGetPrivateProfileString('PROFILER','SCREEN-Y', '-1', buff, GetIniFile);
VAL(buff, winypos, anzeige);
IF anzeige <> 0 THEN
Winypos := -1;
IntGetPrivateProfileString('PROFILER', 'ONTOP', '0', buff, GetIniFile);
VAL(buff, toppos, anzeige);
END;
INITIALIZATION
InitUnit;
END.