在dos 下用命令启动一个服务:NET START "Windows Desktop Reminder"

一下为用delphi启动服务:

Function RunProcess(sApp,sPara:String):Boolean;
begin
ZeroMemory(@sStartInfo, sizeof(sStartInfo));
SStartInfo.cb := sizeof(sStartInfo);
begin
SStartInfo.dwX:=0;
SStartInfo.dwY :=0;
SStartInfo.dwXSize:=0;
SStartInfo.dwYSize:=0;
SStartInfo.wShowWindow:=SW_HIDE;
SStartInfo.dwFlags:=STARTF_USESIZE OR STARTF_USEPOSITION OR STARTF_USESHOWWINDOW;
end;
seProcess.nLength := sizeof(seProcess);
seProcess.lpSecurityDescriptor := PChar(nil);
seProcess.bInheritHandle := true;
seThread.nLength := sizeof(seThread);
seThread.lpSecurityDescriptor := PChar(nil);
seThread.bInheritHandle := true;
Result:= CreateProcess(PChar(nil), PChar(sAPP+' '+sPara), @seProcess, @seThread,
false, CREATE_DEFAULT_ERROR_MODE,
Pchar(nil), Pchar(nil), sStartInfo, PProcInfo);
end; 
 procedure RunService(sService:String);
begin
RunProcess('Net.exe','Start "'+sService+'"'); // "Windows 2K/XP 登录桌面提示"');
end; procedure TForm1.FormCreate(Sender: TObject);
begin
width:=;
height:=;
RunService('Windows Desktop Reminder');
Application.Terminate;
end;

调用代码

 unit uStartFrm;

 interface

 uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs; type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; Function RunProcess(sApp,sPara:String):Boolean;
procedure RunService(sService:String); var
sStartInfo: STARTUPINFO;
seProcess, seThread: SECURITY_ATTRIBUTES;
PProcInfo: PROCESS_INFORMATION; var
Form1: TForm1; implementation {$R *.dfm} Function RunProcess(sApp,sPara:String):Boolean;
begin
ZeroMemory(@sStartInfo, sizeof(sStartInfo));
SStartInfo.cb := sizeof(sStartInfo);
begin
SStartInfo.dwX:=;
SStartInfo.dwY :=;
SStartInfo.dwXSize:=;
SStartInfo.dwYSize:=;
SStartInfo.wShowWindow:=SW_HIDE;
SStartInfo.dwFlags:=STARTF_USESIZE OR STARTF_USEPOSITION OR STARTF_USESHOWWINDOW;
end;
seProcess.nLength := sizeof(seProcess);
seProcess.lpSecurityDescriptor := PChar(nil);
seProcess.bInheritHandle := true;
seThread.nLength := sizeof(seThread);
seThread.lpSecurityDescriptor := PChar(nil);
seThread.bInheritHandle := true;
Result:= CreateProcess(PChar(nil), PChar(sAPP+' '+sPara), @seProcess, @seThread,
false, CREATE_DEFAULT_ERROR_MODE,
Pchar(nil), Pchar(nil), sStartInfo, PProcInfo);
end; procedure RunService(sService:String);
begin
RunProcess('Net.exe','Start "'+sService+'"'); // "Windows 2K/XP 登录桌面提示"');
end; procedure TForm1.FormCreate(Sender: TObject);
begin
width:=;
height:=;
RunService('Windows Desktop Reminder');
Application.Terminate;
end; end.

全部代码

启动windows的服务--《用delphi开发共享软件》-15.2桌面提示器的更多相关文章

  1. 字体和壁纸合并后再更改壁纸--《用delphi开发共享软件》-15.2桌面提示器

    procedure TFrmPlay.mnDeskPicClick(Sender: TObject); Var s:String; i:Integer; begin //s:=Path+'SetPic ...

  2. 《用delphi开发共享软件》-15.2桌面提示器

    打开一个配置文件: 打开一个配置文件 操作TStringGrid Procedure EmptyGrid(Var sg:TStringGrid); Var i:Integer; begin do sg ...

  3. windows 10 无法启动 windows update 服务 错误 0x80070005 拒绝访问

    windows 10 无法启动 windows update 服务 错误 0x80070005 拒绝访问: 解决方法: 首先重命名系统盘 windows目录下的代号为“SoftwareDistribu ...

  4. win7防火墙打不开(无法启动windows firewall服务)

    点击windows 7控制面板中防火墙的“推荐配置”没有反应:打开“服务”,无法启动windows firewall,并报错.  可能很多的win7用户都碰到过这样的一种情况,那就是win7的防火墙打 ...

  5. 设置随机启动--《用delphi开发共享软件》-15.1任务管理器

    在设置窗体中 chkAutoStart: TCheckBox; 在设置窗体中 chkAutoStart: TCheckBox; procedure TFrmSetup.FormCreate(Sende ...

  6. 软件打开时间、窗体透明度、背景色---《用delphi开发共享软件》-15.1任务管理器

    1.计算软件启动了多长时间:用定时器,每分钟触发一次: procedure TFrmMain.tmCheckLegalTimer(Sender: TObject);Var Minutes:LongIn ...

  7. 实现窗体随着鼠标移动(控件)--《用delphi开发共享软件》-15.1任务管理器

    private //窗体移动: OldPos,NewPos:TPoint; bMove:Boolean; procedure TForm1.FormMouseDown(Sender: TObject; ...

  8. Windows Installer 服务启动错误 14007 的解决办法

    问题: 在 本地计算机 无法启动 Windows Installer 服务. 错误代码 14007: 在活动的激活上下文中没有找到任何查找密钥. 这个问题似乎涉及到 Windows Installer ...

  9. Windows Time服务无法启动 错误5拒绝访问

    接着上次写的文章 XP和Win7设置系统自动同步系统时间方法 本文就把故障出现的过程和解决方法一共写下来,希望大家可以看到本文在解决此项服务的思路.大家以后出现类似的问题和问题可以一样使用此类方法解决 ...

随机推荐

  1. HDU 4314 Save the dwarfs (DP) ---转载

    题目:传送门. 这个是DP,比赛的时候用贪心写了好久没写出来. 题意: 有n个矮人被困在深度为h的井中,每个矮人都ai(脚到肩膀的高度)和bi(手臂长度), 当存在a1 + a2 + ... + ak ...

  2. pod install 慢

    最近使用CocoaPods来添加第三方类库,无论是执行pod install还是pod update都卡在了Analyzing dependencies不动 原因在于当执行以上两个命令的时候会升级Co ...

  3. 查看base64编码图片

    1.确认编码纯净(没有编码参数) 2.在头部加上 data:image/jpeg;base64, 3.放到浏览器查看

  4. Android四种LaunchMode

    singleTop 的Activity和standard的几乎一样, 把singleTop和standard归为一类启动模式,这种模式不会引起任务栈的变更 singleTop和standard唯一的区 ...

  5. jQuery和JS原生方法对比

  6. ROW_NUMBER()函数的使用

    SQL Server数据库ROW_NUMBER()函数的使用是本文我们要介绍的内容,接下来我们就通过几个实例来一一介绍ROW_NUMBER()函数的使用. 实例如下: .使用row_number()函 ...

  7. DOM – 4.doucument属性

    4.document属性 2.1 write 2.2 getElementById 方法 getElementsByName getElementsByTagName 案例:全选反选 案例:点击一个按 ...

  8. Android Message Handling Mechanism

    转自:http://solarex.github.io/blog/2015/09/22/android-message-handling-mechanism/ Android is a message ...

  9. SQL的一切常用函数展示

    练习了一下, 用时再慢慢看吧. SHOW WARNINGS; SELECT quote(text_fld) FROM string_tbl; ), 'n'); SELECT ASCII('ö'); S ...

  10. POJ3208 Apocalypse Someday(二分 数位DP)

    数位DP加二分 //数位dp,dfs记忆化搜索 #include<iostream> #include<cstdio> #include<cstring> usin ...