´ Form1
´ qui utilise un control ActivX NTService
Private Sub Form_Load()
Dim bStarted As Boolean
If Command = " -install" Then ´install is ok
If NTService1.Install Then
´ Save default service settings in registry
NTService1.SaveSetting " Parameters", " Interval", " 1000"
MsgBox NTService1.DisplayName & " installed successfully"
Else
MsgBox NTService1.DisplayName & " failed to install"
End If
ElseIf Command = " -uninstall" Then ´unistall is ok
If NTService1.Uninstall Then
MsgBox NTService1.DisplayName & " uninstalled successfully"
Else
MsgBox NTService1.DisplayName & " failed to uninstall"
End If
End
ElseIf Command = " -debug" Then
NTService1.Debug = True
ElseIf Command < > " " Then
MsgBox " Invalid command option"
End
End If
´ Get service settings from registry
Timer.Interval = CInt(NTService1.GetSetting("Parameters", " Interval", " 2000"))
NTService1.StartService
End Sub
´ start the service
´ cause an error 1053
Private Sub NTService1_Start(Success As Boolean)
Open " test.txt" For Random As FreeFile()
Success = True
End Sub
Private Sub NTService1_Stop()
Unload Me
End Sub