Jump to content

Service Control Help


Recommended Posts

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!

Link to comment
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.

Link to comment
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?
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...