473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Is it possible to add an event handler for SHDocVw.WebBrowser or use AxSHDocVw.WebBroswer without a form in a Windows service?

I would like to use a AxSHDocVw.WebBroswer control in a Windows service- is
this possible without creating a form? I added the reference I usually use
to add this object in a Windows Application but only SHDocVw appears under
References in the Solution Explorer.

As an alternative, SHDocVw.WebBrowser may work but I am not sure how to add
an event handler for it- does anyone know how to add a DocCompleted event
for this object?


Aug 7 '07 #1
3 3745
"David" <da*********@yoowhoo.comschrieb:
>I would like to use a AxSHDocVw.WebBroswer control in a Windows service- is
this possible without creating a form? I added the reference I usually use
to add this object in a Windows Application but only SHDocVw appears under
References in the Solution Explorer.

I wonder why you would want to use a visual control in a service which
doesn't provide a user interface.

* What exactly do you want to archieve?
* Which version of .NET are you using?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Aug 7 '07 #2
David,

Not tested however maybe you can try it by using instead of x.webbrowser
x.InterNetExplorer that normaly opens the standard browser.

Cor

"David" <da*********@yoowhoo.comschreef in bericht
news:nY******************************@comcast.com. ..
>I would like to use a AxSHDocVw.WebBroswer control in a Windows service- is
this possible without creating a form? I added the reference I usually use
to add this object in a Windows Application but only SHDocVw appears under
References in the Solution Explorer.

As an alternative, SHDocVw.WebBrowser may work but I am not sure how to
add an event handler for it- does anyone know how to add a DocCompleted
event for this object?


Aug 7 '07 #3
"David" <da*********@yoowhoo.comschrieb:
>>>I would like to use a AxSHDocVw.WebBroswer control in a Windows service-
is this possible without creating a form? I added the reference I
usually use to add this object in a Windows Application but only SHDocVw
appears under References in the Solution Explorer.

I wonder why you would want to use a visual control in a service which
doesn't provide a user interface.

* What exactly do you want to archieve?
* Which version of .NET are you using?

I'm writing a service that will connect to a website on a regular basis,
retrieve information, and then update external devices- this works fine as
an application but I would rather not use task scheduler to run it and a
service sounds like the best method for this. I started out using
HttpWebRequest but was not successful logging into the website with it-
axWebBrowser worked nicely.
Which authentication model does the Web site use?

Maybe this code snippet is of use for you:

<URL:http://dotnet.mvps.org/dotnet/code/net/#CookieRequest>

Otherwise take a look at the 'NetworkCredentials' class.

I would not use the webbrowser control for this purpose. Instead you can
download the file in the background:

<URL:http://dotnet.mvps.org/dotnet/code/net/#InternetLoadFile>

Parsing an HTML file:

MSHTML Reference
<URL:http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/reference.asp>

- or -

..NET Html Agility Pack: How to use malformed HTML just like it was
well-formed XML...
<URL:http://blogs.msdn.com/smourier/archive/2003/06/04/8265.aspx>

Download:

<URL:http://www.codefluent.com/smourier/download/htmlagilitypack.zip>

- or -

SgmlReader 1.4
<URL:http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=B90FDDCE-E60D-43F8-A5C4-C3BD760564BC>

If the file read is in XHTML format, you can use the classes contained in
the 'System.Xml' namespace for reading information from the file.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Aug 7 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Hautzendorfer | last post by:
Hello, I'm currently working on some printing stuff: I have to print out several .xml files using a stylesheet. Therefor I choose the Internetexplorer PlugIn via SHDocVW. My problem: After...
1
by: SunshineGirl | last post by:
I'm trying to connect an event handler to the BeforeNavigate2 event of Internet Explorer. This works in a Windows app, but I can't get it to work in a Windows service. I get the following exception...
3
by: Wiktor Zychla | last post by:
I have a problem I cannot solve. My application hosts IE activex control. I follow the standard procedure: I just aximp shdocvw.dll. Note that this gives you two files: axshdocvw.dll and...
2
by: Or Lavy | last post by:
Hi there, As mentioned in message "aximp of shdocvw.dll -> problem with ShellExecute" posted before, aximp creates two files: AxSHDocVW.dll SHDocVW.dll The second has the same name as the...
0
by: omyek | last post by:
Heh, I know some of you have read the subject and are wondering what in the heck I'm doing. Well, for all intensive purposes, I've had to embed a WebBrowser control into a DLL and reference that...
10
by: SunshineGirl | last post by:
In my code, class A instanciates classes B and C. I would like class B to connect an event handler to a method in class A, and for class C to disconnect that event handler. I think I've done...
1
by: Daniel Frede | last post by:
Hello, I Created a AxSHDocVw.AxWebBrowser in a class and want to Post Values to a WebPage. When I use this class in a Windows application, everything is fine, but in an ASPX page it hangs...
4
by: Supra | last post by:
I have a tab control in a which a few of the tabs include an AxWebBrowser browser control. Let say i have currently tabpage2 and i typed url in combobox when i pressed enter it doesn't display...
4
by: Robson Siqueira | last post by:
Folks, I am facing a problem. I am trying to manipulate the HTML data (thru the Document and DocumentText properties) of the WebBrowser object (System.Windows.Forms). The problem is that the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.