# About NTsvr.OCX.....

Posted by Kingkong on July 17, 1998 at 11:30:39:

First,Thanks for you help!
But...

I do as you said:

Private Sub Form_Load()
If Command = "-install" Then
' enable interaction with desktop
NTService1.Interactive = True
NTService1.Install
NTService1.ControlsAccepted = svcCtrlPauseContinue
NTService1.StartService
End
ElseIf Command = "-uninstall" Then
NTService1.StopService
NTService1.Uninstall
End
End If

.......

End sub

then open "Control panel/service", set my service to "Start". But i get the error message "The service is not responding to the control function." , what's means the message ?

In sample code come with the NTsvr.OCX, there is not a "END" sentence after "StartService" :

Private Sub Form_Load()

On Error GoTo Err_Load
Dim strDisplayName As String
Dim bStarted As Boolean
strDisplayName = NTService1.DisplayName
StatusBar.Panels(1).Text = "Loading"
If Command = "-install" Then
NTService1.Interactive = True
If NTService1.Install Then
Call NTService1.SaveSetting("Parameters", "TimerInterval", "1000")
MsgBox strDisplayName & " installed successfully"
Else
MsgBox strDisplayName & " failed to install"
End If
End
ElseIf Command = "-uninstall" Then
If NTService1.Uninstall Then
MsgBox strDisplayName & " uninstalled successfully"
Else
MsgBox strDisplayName & " failed to uninstall"
End If
End
ElseIf Command = "-debug" Then
NTService1.Debug = True
ElseIf Command <> "" Then
MsgBox "Invalid command option"
End
End If
Timer.Interval = CInt(NTService1.GetSetting("Parameters", "TimerInterval", "2000"))
NTService1.ControlsAccepted = svcCtrlPauseContinue
NTService1.StartService
Err_Load:
Call NTService1.LogEvent(svcMessageError, svcEventError, "[" & Err.Number & "] " & Err.Description)
End Sub

Follow Ups:

- ÄãÓÖÐ´´íÁË Ð¡Îâ 16:20:24 7/17/98 (0)