473,785 Members | 2,317 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is it possible to add an event handler for SHDocVw.WebBrow ser or use AxSHDocVw.WebBr oswer without a form in a Windows service?

I would like to use a AxSHDocVw.WebBr oswer 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.WebBrow ser 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 3774
"David" <da*********@yo owhoo.comschrie b:
>I would like to use a AxSHDocVw.WebBr oswer 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.InterNetExplo rer that normaly opens the standard browser.

Cor

"David" <da*********@yo owhoo.comschree f in bericht
news:nY******** *************** *******@comcast .com...
>I would like to use a AxSHDocVw.WebBr oswer 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.WebBrow ser 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*********@yo owhoo.comschrie b:
>>>I would like to use a AxSHDocVw.WebBr oswer 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 'NetworkCredent ials' 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/#InternetLoadFi le>

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.c om/Community/UserSamples/Details.aspx?Sa mpleGuid=B90FDD CE-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
3939
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 sending the print command via ExecWB for the first .xml document either the preview or the printer selection window occurs (depending on the passed parameter). This behaviour is ok.
1
463
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 when I run the line "shellWindows = new SHDocVw.ShellWindowsClass();": COM object with CLSID {9BA05972-F6A8-11CF-A442-00A0C90A8F39} is either not valid or not registered. I know that this CLSID belongs to the ShellWindows interface.
3
5473
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 shdocvw.dll. And there comes the problem. I reference the libraries from my project. For this to work, I put the libraries in the same directory as the application. Now, from my code I try to ShellExecute to a link (to show it in a new window):
2
2745
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 original dll, and that makes problems with internet explorer. The offered solution was disassembly the interops using the ildasm
0
2195
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 DLL in a windows service I've created. The problem is I get the following error/stacktrace: System.Threading.ThreadStateException: Could not instantiate ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' because the current thread is not...
10
3499
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 too much thinking, and now I'm even more confused as to how to accomplish this as when I started. Any help will be appreciated.
1
3696
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 after the .submit (see code) Even if i try to start the class in a new thread it terminates at the ..submit
4
3490
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 webbrowser instead i can do create new tab. ne one knows how to display currrently displayed regardless of tabpage(s)? here is code: Public Sub AddBrowserTab() AxWebBrowser1.Visible = False Dim newPage As TabPage = New TabPage(Text) ' Delcare and...
4
13369
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 application enters in a loop state and my changes don't apply. Have somebody faced the same problem? Any solutions?
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9947
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.