📄 project1.dpr
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -