Sign in to follow this  
Followers 0
TehWhale

Service Control Help

5 posts in this topic

I just needed a bit of clarification.

If I create a service, and start the service, it will run at startup correct?

I am making a backup utility, and want to have a service so you don't have to have the actual program running all the time, you will have a service to do it.

This is some test code.

; Create/delete the WinVNC service
; You must copy both the winvnc.exe and vnchooks.dll file to the Windows directory before
; running this code.
If _ServiceExists("", "WinVNC") Then
   MsgBox(4096,'debug:' , 'WinVNC service exists') ;### Debug MSGBOX
   If _ServiceRunning("", "WinVNC") Then
      MsgBox(4096,'debug:' , 'WinVNC service running') ;### Debug MSGBOX
      If _StopService("", "WinVNC") Then
         Sleep(1000)
         MsgBox(4096,'debug:' , 'WinVNC service stopped') ;### Debug MSGBOX
         If _DeleteService("", "WinVNC") Then
            MsgBox(4096,'debug:' , 'WinVNC service deleted') ;### Debug MSGBOX
         EndIf
      EndIf
   Else
      If _DeleteService("", "WinVNC") Then
         MsgBox(4096,'debug:' , 'WinVNC service deleted') ;### Debug MSGBOX
      EndIf      
   EndIf
Else
   $nRet = _CreateService("", _
                          "WinVNC", _
                          "VNC Server", _
                          "%SystemRoot%\winvnc.exe -service", _
                          "LocalSystem", _
                          "", _
                          BitOR($SERVICE_WIN32_OWN_PROCESS, $SERVICE_INTERACTIVE_PROCESS))
   If $nRet Then
      MsgBox(4096,'debug:' , 'WinVNC service created') ;### Debug MSGBOX
      If _StartService("", "WinVNC") Then
         MsgBox(4096,'debug:' , 'WinVNC service started') ;### Debug MSGBOX
      EndIf
   Else
      MsgBox(4096,'debug:' , 'Failed to create WinVNC service: ' & @error) ;### Debug MSGBOX
   EndIf
EndIf

So, if I was going to use FileInstall() where would

"%SystemRoot%\winvnc.exe -service"
be with macros? like @WindowsDir or @SystemDir?

Thats all the information I need! Thanks for your help guys!

Share this post


Link to post
Share on other sites



I just needed a bit of clarification.

If I create a service, and start the service, it will run at startup correct?

Not necessary, a service in WinXP can have on of three "startup types".

Automatic.

Manual.

Disabled.

Windows Vista added: "Automatic (Delayed Start)"

I don't know how that service is created so I can't tell if it's Automatic or not, you better check yourself what it is setting itself on.

Share this post


Link to post
Share on other sites

Not necessary, a service in WinXP can have on of three "startup types".

Automatic.

Manual.

Disabled.

Windows Vista added: "Automatic (Delayed Start)"

I don't know how that service is created so I can't tell if it's Automatic or not, you better check yourself what it is setting itself on.

Thanks. Well how can I set it to Automatic.

$nRet = _CreateService("", _                          "EzBackup Pro", _                       "EzBackup Service", _                       "%SystemRoot%\EzBServ.exe", _                       "LocalSystem", _                        "", _                       BitOR($SERVICE_WIN32_OWN_PROCESS, $SERVICE_INTERACTIVE_PROCESS))
So would this automatically start and stuff?

Share this post


Link to post
Share on other sites

I have no idea, I have done such things with autoit and services, but do you not run the code yourself and check which "startup type" it sets?

I just want a simple service that will run at startup! ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0