Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi everyone,

 

I've created a windows service with a timer which opens a IE browser window targeted at a specific page/script. It works if I run the executable itself, however when I install it as a service using InstallUtil and then manually start the service it does not work.

 

Any thoughts, suggestions or fixes would be really helpful.

 

Code from the service.vb file is below.

 

Thanks!

 

 

   Protected Overrides Sub OnStart(ByVal args() As String)
       ' Add code here to start your service. This method should set things
       ' in motion so your service can do its work.
       Timer1.Enabled = True
   End Sub

   Protected Overrides Sub OnStop()
       ' Add code here to perform any tear-down necessary to stop your service.
       Timer1.Enabled = False
   End Sub

   'Set variables for use in the Tracker
   Public Explorer As SHDocVw.InternetExplorer

   Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
       Explorer = New SHDocVw.InternetExplorer
       Explorer.Visible = True
       Explorer.Navigate("http://www.microsoft.com")
   End Sub

  • Leaders
Posted

you need to take a look at the System.Diagnostics.Process class to open your IE window really. ( no need to use SHDocVw.InternetExplorer to open a new IE window ) eg:

System.Diagnostics.Process.Start("IEXPLORE.EXE", "http://www.microsoft.com")
'/// open a new instance of IE and navigate to your chosen site.

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...