|
-
Oct 23rd, 2005, 04:26 PM
#1
Thread Starter
Lively Member
service and "Allow service interact with desktop"
Hi guys...
I have created a win service with icon.
Icon is displayed only if : Allow service interact with desktop.
Is there a way to avoid to set the "Allow service interact with desktop" manually and to do it programmatically with vb.net o during setup?
thank for any suggestions
-
Nov 15th, 2005, 08:46 AM
#2
Lively Member
Re: service and "Allow service interact with desktop"
Hi i had the same problem. U can set it programatically with the following code:
(After installing the event ServiceInstaller1_Committed will rise and set the option to "Allow service interact with desktop" )
Imports System.ComponentModel
Imports System.Configuration.Install
Imports System.Management
Private Sub ServiceInstaller1_Committed(ByVal sender As Object, ByVal e As System.Configuration.Install.InstallEventArgs) Handles ServiceInstaller1.Committed
Dim coOptions As New ConnectionOptions
coOptions.Impersonation = ImpersonationLevel.Impersonate
Dim mgmtScope As ManagementScope = New ManagementScope("root\CIMV2", coOptions)
mgmtScope.Connect()
Dim wmiService As ManagementObject
wmiService = New ManagementObject("Win32_Service.Name='" + Me.ServiceInstaller1.ServiceName + "'")
Dim InParam As ManagementBaseObject = wmiService.GetMethodParameters("Change")
InParam("DesktopInteract") = True
Dim OutParam As ManagementBaseObject = wmiService.InvokeMethod("Change", InParam, Nothing)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|