R
Rob R. Ainscough
I have a VS 2005 Windows Service with a Installer project as part of my
solution. The Service installs fine but I can't seem to make either of
these work:
1. Have the service start after install
2. Have the service interact with the SysTray
In my ProjectInstaller.vb
Private Sub ServiceInstaller1_AfterInstall(ByVal sender As
System.Object, ByVal e As System.Configuration.Install.InstallEventArgs)
Handles ServiceInstaller1.AfterInstall
Dim OS_EventLog As New MyStuff.Utilities.OperatingSystem
Try
Dim KeyPath As String = "SYSTEM\CurrentControlSet\Services\" &
Me.ServiceInstaller1.ServiceName
Dim ckey As RegistryKey =
Registry.LocalMachine.OpenSubKey(KeyPath, True)
If ckey IsNot Nothing Then
ckey.SetValue("Type", CInt(272))
End If
Catch ex As Exception
OS_EventLog.CreateEventLogEntry("After Install Failed: " &
ex.ToString)
End Try
End Sub
This code works in the sense that the "Interacts with Desktop" checkbox IS
checked, but I still don't see my icon show in the systray. If I manually
go to my installed service and uncheck and then recheck and then start the
service again -- my icon WILL show in the systray. Is there more than one
reg entry to be set to make this work? Any hints or links where I can go to
make this do the above two tasks work reliably?
Thanks, Rob.
solution. The Service installs fine but I can't seem to make either of
these work:
1. Have the service start after install
2. Have the service interact with the SysTray
In my ProjectInstaller.vb
Private Sub ServiceInstaller1_AfterInstall(ByVal sender As
System.Object, ByVal e As System.Configuration.Install.InstallEventArgs)
Handles ServiceInstaller1.AfterInstall
Dim OS_EventLog As New MyStuff.Utilities.OperatingSystem
Try
Dim KeyPath As String = "SYSTEM\CurrentControlSet\Services\" &
Me.ServiceInstaller1.ServiceName
Dim ckey As RegistryKey =
Registry.LocalMachine.OpenSubKey(KeyPath, True)
If ckey IsNot Nothing Then
ckey.SetValue("Type", CInt(272))
End If
Catch ex As Exception
OS_EventLog.CreateEventLogEntry("After Install Failed: " &
ex.ToString)
End Try
End Sub
This code works in the sense that the "Interacts with Desktop" checkbox IS
checked, but I still don't see my icon show in the systray. If I manually
go to my installed service and uncheck and then recheck and then start the
service again -- my icon WILL show in the systray. Is there more than one
reg entry to be set to make this work? Any hints or links where I can go to
make this do the above two tasks work reliably?
Thanks, Rob.