📄 logbook.dpr
字号:
{*******************************************************}
{ }
{ A Windows program for log StartUp and }
{ ShutDown time of computer }
{ }
{ Copyright(c) 1999..2000, Su Chengxiang }
{ }
{*******************************************************}
Program Logbook;
uses
Windows, SysUtils,
TinyApp in 'TinyApp.pas',
LogFile in 'LogFile.pas';
{$R Logbook0.RES}
const
LogName: shortstring = 'Logbook.txt';
type
PLogbookApp = ^TLogbookApp;
TLogbookApp = object(TTinyApp)
FDTLogFile: PDateTimeLogFile;
constructor Create(Name: ShortString);
destructor Destroy; virtual;
function DoOnStart: Bool; virtual;
function DoOnExit: Bool; virtual;
end;
{ TLogbookApp }
constructor TLogbookApp.Create(Name: ShortString);
var
AIcon: HICON;
Str1: string;
begin
inherited Create(Name);
FDTLogFile:= New(PDateTimeLogFile, Create(LogName));
if (FDTLogFile = nil) then
begin
ProcessError;
FTerminate:= True;
end;
if FTrayIcon <> nil then
begin
DateTimeToString(Str1, '"开机 "hh:nn', StartUpTime);
AIcon:= LoadIcon(FHInstance, 'MAINICON');
FTrayIcon^.Add(IDI_MyFirst+1, AIcon, Str1);
end;
end;
destructor TLogbookApp.Destroy;
begin
if FDTLogFile <> nil then FDTLogFile^.Free;
inherited Destroy;
end;
function TLogbookApp.DoOnStart: Bool;
begin
FDTLogFile^.WriteStartUpTime;
Result:= True;
end;
function TLogbookApp.DoOnExit: Bool;
begin
FDTLogFile^.WriteShutDownTime;
Result:= True;
end;
var
MyApp: PLogbookApp;
procedure WinMain(hInstCurrent, // handle to current instance
hInstPrev: HINST; // handle to previous instance
lpszCmdLine: LPSTR; // pointer to command line
nCmdShow: integer); // show state of window
var R: Integer;
begin
MyApp:= New(PLogbookApp, Create('Logbook'));
//MyApp^.FMainWindow^.Show(SW_HIDE);
MyApp^.Run;
R:= MyApp^.FReturnValue;
MyApp^.Free;
Halt(R);
end;
begin
WinMain(hInstance, hPrevInst, CmdLine, CmdShow);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -