Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I use vb.net to write a win service program, after finish installation, I switch on the service however it haven't any response so is there any way to solve it.

 

Code:

Service1.vb

 

Protected Overrides Sub OnStart(ByVal args() As String)

Timer1.Enabled = True

End Sub

 

Protected Overrides Sub OnStop()

Timer1.Enabled = False

End Sub

 

Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed

MsgBox("A") <-- show letter "A" at each second

End Sub

 

- Timer1 Property:

Name: Timer1

AutoReset: True

Enabled: False

Interval: 1000

Modifiers: Friend

 

ProjectInstaller.vb

 

- ServiceInstaller1 Property:

Name: ServiceInstaller1

DisplayName: ServiceTest

Modifiers: Friend

Parent: ProjectInstaller

ServiceName: ServiceTest

ServicesDependedOn: String[]

StartType: Manual

 

- ServiceProcessInstaller1 Property:

Name: ServiceProcessInstaller1

Account: LocalSystem

Modifiers: Friend

Parent: ProjectInstaller

 

Thank for your help (^_^)

  • Administrators
Posted
I'm assuming the problem is that you aren't seeing the message box - correct? If so that is normal behaviour - services do not run within the logged on user's desktop (in fact the will run with no user logged in at all), this means they have there own desktop that just happens to never be displayed on screen - hence you cannot see the message box.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
I'm assuming the problem is that you aren't seeing the message box - correct? If so that is normal behaviour - services do not run within the logged on user's desktop (in fact the will run with no user logged in at all)' date=' this means they have there own desktop that just happens to never be displayed on screen - hence you cannot see the message box.[/quote']

 

I would stop using the timer control from the toolbox (This needs a form to run), and start using the timer from the threading classes. There is an example of this on the quickstarts availible on gotdotnet.com on the toolbox menu on the left. There is also a basic service application.

Glenn "Mykre" Wilson, DirectX MVP

Inner Realm

Managed DirectX and Game Programming Resources

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...