启动windows的服务--《用delphi开发共享软件》-15.2桌面提示器
在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桌面提示器的更多相关文章
- 字体和壁纸合并后再更改壁纸--《用delphi开发共享软件》-15.2桌面提示器
procedure TFrmPlay.mnDeskPicClick(Sender: TObject); Var s:String; i:Integer; begin //s:=Path+'SetPic ...
- 《用delphi开发共享软件》-15.2桌面提示器
打开一个配置文件: 打开一个配置文件 操作TStringGrid Procedure EmptyGrid(Var sg:TStringGrid); Var i:Integer; begin do sg ...
- windows 10 无法启动 windows update 服务 错误 0x80070005 拒绝访问
windows 10 无法启动 windows update 服务 错误 0x80070005 拒绝访问: 解决方法: 首先重命名系统盘 windows目录下的代号为“SoftwareDistribu ...
- win7防火墙打不开(无法启动windows firewall服务)
点击windows 7控制面板中防火墙的“推荐配置”没有反应:打开“服务”,无法启动windows firewall,并报错. 可能很多的win7用户都碰到过这样的一种情况,那就是win7的防火墙打 ...
- 设置随机启动--《用delphi开发共享软件》-15.1任务管理器
在设置窗体中 chkAutoStart: TCheckBox; 在设置窗体中 chkAutoStart: TCheckBox; procedure TFrmSetup.FormCreate(Sende ...
- 软件打开时间、窗体透明度、背景色---《用delphi开发共享软件》-15.1任务管理器
1.计算软件启动了多长时间:用定时器,每分钟触发一次: procedure TFrmMain.tmCheckLegalTimer(Sender: TObject);Var Minutes:LongIn ...
- 实现窗体随着鼠标移动(控件)--《用delphi开发共享软件》-15.1任务管理器
private //窗体移动: OldPos,NewPos:TPoint; bMove:Boolean; procedure TForm1.FormMouseDown(Sender: TObject; ...
- Windows Installer 服务启动错误 14007 的解决办法
问题: 在 本地计算机 无法启动 Windows Installer 服务. 错误代码 14007: 在活动的激活上下文中没有找到任何查找密钥. 这个问题似乎涉及到 Windows Installer ...
- Windows Time服务无法启动 错误5拒绝访问
接着上次写的文章 XP和Win7设置系统自动同步系统时间方法 本文就把故障出现的过程和解决方法一共写下来,希望大家可以看到本文在解决此项服务的思路.大家以后出现类似的问题和问题可以一样使用此类方法解决 ...
随机推荐
- 【Git】参与github上其他人的项目
来源:廖雪峰 访问感兴趣的项目主页.,点“Fork”就在自己的账号下克隆了该项目仓库,然后,从自己的账号下clone到本地,就可以工作啦~ 以bootstrap项目为例,这个关系如下图所示: 一定要从 ...
- SQL常用命令整理
1.增加字段 alter table docdsp add dspcodechar(200)2.删除字段 ALTER TABLE table_NAME DROP COLUMNcolum ...
- ios NSLayoutConstraint
为了让我们的应用在不同尺寸的屏幕下都能 “正常”的表示,我们尽量不要把数据写死.大多数可视元素都是一个矩形区域,当然这个矩形区域有坐标的,我们有了这个区域坐标就能确定可视元素的现实位置了.但是ipho ...
- IOS-委托代理(degegate)
委托代理: 委托代理(degegate)顾名思义,把某个对象要做的事情委托给别的对象去做.那么别的对象就是这个对象的代理,代替它来打理要做的事.反映到程序中, 首先要明确一个对象的委托方是哪个对象,委 ...
- C#命名规范的几点建议
1.最好以<Company>.<Component>做为namespace的格式 2.考虑是否需要将namespace设置为复数,如:FCL中的System.Collectio ...
- kmp
#include <bits/stdc++.h> #define MAXN 100000 using namespace std; string a, b; int next[MAXN]; ...
- LNMP平台搭建---Linux系统安装篇
在互联网网站开发领域,有一个名词,大家一定不陌生,那就是LAMP,经典的Web服务器环境,由Linux+Apache+MySQL+PHP组成,,后来,一个名叫Nginx的Web服务器开源出来了,因其更 ...
- MYSQL建表语法(主键,外键,联合主键)
在看<Learning SQL>第二版, 慢慢打实SQL的基础. 建表一: ), lname ), gender ENUM(), city ), state ), country ), p ...
- SQLAlchemy Core中的异常及事务处理样码
这部门内容比较简单,立存. #coding=utf-8 from datetime import datetime from sqlalchemy import (MetaData, Table, C ...
- oracle 11g r1 RAC增加新节点
在一套两节点的rac上增加一个新的节点,详细的操作记录如下: 已有节点RAC1,RAC2 一,环境及版本: 公司环境:Vmware Esxi 5.5 操作系统:Redhat 5.8 x86_64 ...