salut
j'ai un fichier prog1.exe dans c: par ex
je veux le mettre en service
un ami m'a donné cette fonction :
dans mon appli delphi, dans un boutton je met :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 function ServiceCreate(sService,sDisplay,sPath:string):bool; var schm, schs : SC_Handle; begin result:=false; schm:=OpenSCManager(nil, nil, SC_MANAGER_ALL_ACCESS); if (schm > 0) then begin schs:=CreateService(schm,pchar(sService),pchar(sDisplay),SC_MANAGER_ALL_ACCESS,SERVICE_WIN32_OWN_PROCESS,SERVICE_AUTO_START,SERVICE_ERROR_IGNORE,pchar(sPath),nil,nil,nil,nil,nil); if schs > 0 then result:=true else messagebox(0,pchar(inttostr(getlasterror)),0,0); CloseServiceHandle(schs); CloseServiceHandle(schm); end; end;
le service est bien créé mais il est en mode "stop"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 ServiceCreate('zzservice','zzdisplayname','c:\prog1.exe');
ai je oubléi qq chose ? comment faire pour qu'il soit sur start ?
j'ai fais qq recherche sur le forum et la fq mais ça ne correpsond pas à ce que je veux faire
Partager