Interop.SHDocVw: Unspecified error

  • Thread starter Thread starter Ian Macro
  • Start date Start date
I

Ian Macro

I have written a VB .Net Console application which uses
SHDocVw.InternetExplorer(). This works perfectly when run
in the foreground but I need to schedule this as a
background job. When ever I run it as a scheduled tasks I
get an Unspecified Error exception when I call the .Busy
or the .Document properties.

Can anyone please help me with this?
 
Hello,

I tested following code:

Imports System.Threading

Module Module1

Sub Main()

Dim myie As New SHDocVw.InternetExplorer

myie.Navigate2("www.google.com")


Console.Write("opening")
While myie.Busy

Thread.CurrentThread.Sleep(100)
Console.Write(".")

End While

Console.WriteLine("")

Console.Write(myie.Document)

End Sub

End Module

And the add the assembly as a scheduled task, it was run correctly, and I
haven't found the problem. I suggest you may check if the scheduled task
was executed under a proper account, for example, your current logon
account. Addtionally, you may add some Try...Catch statement in your code
and to see if you can catch the detailed exception information within it.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
It works as a scheduled job as long as it is scheduled as
the current foreground user. If you schedule it as a
valid user that is not the current logged on user then it
fails with Unspecified Error.

I made the user an administrator to ensure there were no
permissions problems.
 
Hello,

I also found the problem with a different account. SHDocVw.InternetExplorer
is a component with UI. When the application was run under a different
account, there will be a access denied error because a different account
has no permission to access current logon account's desktop and use
SHDocVw.InternetExplorer component. If you need to access some web page is
the scheduled task application, I suggest you may try HttpWebRequest class
in .NET framework.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top