Hello all,
I have a windows application that programmatically sends an html document to the printer using the AxSHDocVw.AxWebBrowser object. The application works beautifully. I tried to convert it to a windows service, and the application stopped working. I'm assuming because in my code I first Navigate to the document, and then print it --> since a service runs under a different context, the navigation/printing fails.
I tried to schedule the application using the task scheduler, and the code only works (i.e. documents print) when I'm logged in. Once I log off, the application runs, but fails on the Navigate function:
System.InvalidCastException: QueryInterface for interface SHDocVw.IWebBrowser2 failed.
at SHDocVw.IWebBrowser2.Navigate(String URL, Object& Flags, Object& TargetFrameName, Object& PostData, Object& Headers)
at AxSHDocVw.AxWebBrowser.Navigate(String uRL, Object& flags, Object& targetFrameName, Object& postData, Object& headers)
Do you guys know how I can get around this?
Thanks
kmsultan