project1.dpr
来自「定时关机程序」· DPR 代码 · 共 39 行
DPR
39 行
program Project1;
uses
SvcMgr,Windows,
Unit3 in 'Unit3.pas' {Service2: TService};
{$R *.res}
function ShellExecute(hWnd: HWND; Operation, FileName, Parameters,
Directory: PChar; ShowCmd: Integer): HINST; stdcall;
external 'shell32.dll' name 'ShellExecuteA';
function ReadFromRegistry:Boolean;
var
TempKey: HKey;
begin
Result:=False;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Services\Service2', 0,KEY_READ, TempKey);
if TempKey=0 then Exit; //MessageBox(GetDesktopWindow,'a','b',64);
RegCloseKey(TempKey);
Result:=True;
end;
begin
if ParamCount=0 then
begin
if not ReadFromRegistry then
begin
ShellExecute(GetDesktopWindow,'open',PChar(ParamStr(0)),' /install',nil,5);
Exit;
end;
end;
Application.Initialize;
Application.CreateForm(TService2, Service2);
Application.Run;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?