易截截图软件、单文件、免安装、纯绿色、仅160KB

delphi 動態安裝服務


unit winntService;
interface
uses
Windows,WinSvc,WinSvcEx;
function InstallService(const strServiceName,strDisplayName,strDescription,strFilename: string):Boolean;
procedure UninstallService(strServiceName:string);
implementation
function StrLCopy(Dest: PChar; const Source: PChar; MaxLen: Cardinal): PChar; assembler;
asm
PUSH EDI
PUSH ESI
PUSH EBX
MOV ESI,EAX
MOV EDI,EDX
MOV EBX,ECX
XOR AL,AL
TEST ECX,ECX
JZ @@1
REPNE SCASB
JNE @@1
INC ECX
@@1: SUB EBX,ECX
MOV EDI,ESI
MOV ESI,EDX
MOV EDX,EDI
MOV ECX,EBX
SHR ECX,2
REP MOVSD
MOV ECX,EBX
AND ECX,3
REP MOVSB
STOSB
MOV EAX,EDX
POP EBX
POP ESI
POP EDI
end;
function StrPCopy(Dest: PChar; const Source: string): PChar;
begin
Result := StrLCopy(Dest, PChar(Source), Length(Source));
end;
function InstallService(const strServiceName,strDisplayName,strDescription,strFilename: string):Boolean;
var
//ss : TServiceStatus;
//psTemp : PChar;
hSCM,hSCS:THandle;
Service: SC_HANDLE;
srvdesc : PServiceDescription;
desc : string;
//SrvType : DWord;
lpServiceArgVectors:pchar;
begin
Result:=False;
hSCM:=OpenSCManager(nil,nil,SC_MANAGER_ALL_ACCESS);
if hSCM=0 then Exit;
Service := OpenService(hSCM, Pchar(strServiceName), SERVICE_ALL_ACCESS);
if Service<=0 then
begin
hSCS:=CreateService(
hSCM,
Pchar(strServiceName),
Pchar(strDisplayName),
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS or SERVICE_INTERACTIVE_PROCESS,
SERVICE_AUTO_START,
SERVICE_ERROR_IGNORE,
Pchar(strFilename),
nil,
nil,
nil,
nil,
nil);
if hSCS=0 then Exit;//MessageBox(hHandle,Pchar(SysErrorMessage(GetLastError)),Pchar(Application.Title),MB_ICONERROR+MB_TOPMOST);
if Assigned(ChangeServiceConfig2) then
begin
desc := Copy(strDescription,1,1024);
GetMem(srvdesc,SizeOf(TServiceDescription));
GetMem(srvdesc^.lpDescription,Length(desc) + 1);
try
StrPCopy(srvdesc^.lpDescription, desc);
ChangeServiceConfig2(hSCS,SERVICE_CONFIG_DESCRIPTION,srvdesc);
finally
FreeMe


相关文档:

Delphi多线程学习(10):Label(VCL)同步的问题

上文中,多线程同步主窗体的Label的Caption属性值,发现一个问题:使用Synchronize用于同步的时候,主窗体好像死掉一样;而直接用子程序为Label的引用赋值,则有时会出现“Canvas  does not allow drawing”错误。书上说VCL同步一定要用Synchronize,而不能直接访问。
    测试:
{主窗体} ......

Delphi皮肤控件分析与QQ的皮肤变色功能

     关于界面美化方面,一直是一个脑壳疼的问题!以前一直偷懒,使用的三方控件!但是在使用了一段时间之后,都或多或少的有些问题!不是我说三方控件如
何如何的不好!只是三方控件多是庞大的一个肢体,要兼顾的用户群体很多,所以同时它要考虑的问题也增加了很多,然而一个程序出现Bug是在所难免的 ......

Delphi中的Record


在Delphi中的Record类型中,与之C语言对应的即是结构体类型(struct
),也可能是为了符合C语言或C++程序员的习惯,对于它在Delphi中的应用存在的一些问题进行初步的说明。在Delphi中的记录体类型有两种方式定义
Type
    RecTest = record (packed
)
      ID :integer; ......

Delphi 2010 破解的方法[通用]

破解方法都是用了盒子 Delphi.Distiller.v1.85
费话不多说
 安装任意delphi 2010 正式版
 序列号是 HAAL-DANSGN-FZR5AG-M3BS
  安装完之后点击开始->Embarcadero RAD Studio 2010 ->Check for update
             &nb ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号