473,382 Members | 1,359 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,382 software developers and data experts.

Using the webbrowser control

Hi All,

Just after some other opinions really....

We're writing this application that in places implements the WebBrowser
control to make certain bits look nicer as well as make things quicker to
develop. To write each page as an owner drawn control would take ages.

The only thing that bothers me is the comminication between the browser
control and the main application. We're using the mshtml.dll to hook events
to buttons and finding the objects in the HTML pages by extending the DOM
and adding our own attributes to certain HTML elements - this is sort of
ok - but it seems a bit flakey. I.e. lots of re-hooking of HTML element
events, and periodically some elements don't re-hook to a handler after the
HTML document is refreshed.

Obviously, the hooking of element events to methods in my C# application can
occure only after the HTML Document has finished loading - so i do it on the
DocumentComplete event. But the page is obviously loaded by the WebBrowser
control by one or more threads, so do I need to build in thread safety when
processing these events?

I just need someone really to say, yes you're doing it the right way.... if
I am?

TIA

Sam Martin
Nov 15 '05 #1
1 2638
Sam,

Don't worry about the threading. The WebBrowser control, because it is
a visual control, is a Single Threaded component. This means that all
access to it is serialized through one thread. Consequently, all events
coming out of it should occur on that same thread as well. Because of this,
you only have to worry about your components being accessed on the UI
thread.

As for finding the objects in the HTML pages, I don't think you should
add your own attributes. I think that you should use the ID attribute and
set it to something unique, using your own scheme.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"boxim" <sa*********@yahoo.co.uk> wrote in message
news:uJ*************@TK2MSFTNGP10.phx.gbl...
Hi All,

Just after some other opinions really....

We're writing this application that in places implements the WebBrowser
control to make certain bits look nicer as well as make things quicker to
develop. To write each page as an owner drawn control would take ages.

The only thing that bothers me is the comminication between the browser
control and the main application. We're using the mshtml.dll to hook events to buttons and finding the objects in the HTML pages by extending the DOM
and adding our own attributes to certain HTML elements - this is sort of
ok - but it seems a bit flakey. I.e. lots of re-hooking of HTML element
events, and periodically some elements don't re-hook to a handler after the HTML document is refreshed.

Obviously, the hooking of element events to methods in my C# application can occure only after the HTML Document has finished loading - so i do it on the DocumentComplete event. But the page is obviously loaded by the WebBrowser control by one or more threads, so do I need to build in thread safety when processing these events?

I just need someone really to say, yes you're doing it the right way.... if I am?

TIA

Sam Martin

Nov 15 '05 #2

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

Similar topics

2
by: dxben | last post by:
I am considering a situation where I have (n) number of form windows, each with an instance of the Microsoft Web Browser Control (IE) on each form. In each web browser control is an HTML page that...
10
by: Selden McCabe | last post by:
I'm trying to display some HTML on a form in a VB.Net project. I've referenced the COM WebBrowser control, and put an instance of it on my form. But during the Form_Load, I'm getting the...
8
by: Prosperz | last post by:
Hi, I would like to make thumbnails of web page by capture content of a WebBrowser. By example, capture http://www.google.com. I used WebBrowser control with Framework 2.0. I try this : ...
5
by: mabond | last post by:
Hi recently read a posting and reply about Excel processs still running after the Appliction.Quit was called. Thought I might be able to use the same...
4
by: Steve Richter | last post by:
I would like to build an HTML stream as a string and have the WebBrowser control render that HTML. Then on PostBack, or whatever it is called, I would like my code to be the one that receives what...
1
by: JP2006 | last post by:
I'm trying to write a control that will take a screen capture of a particular website when a user submits a form in a web application; one of the form fields is for a URL - the control needs to get...
6
by: Leon | last post by:
Hi there, I am trying to use the WebBrowser Control in a form which is being started in an own thread by the main form of my application. Unfortunately I am always getting an error in...
5
by: kimiraikkonen | last post by:
Hi, I couldn't find a necessary class which shows when mouse hovers on a link in Webbrowser control. Think of there's a status bar(text), when mouse comes on a link, the URL must be shown in...
0
by: =?Utf-8?B?Q29kZVJhem9y?= | last post by:
I am converting a windows application which contains a web browser control into an ASP.net application. The Windows project references all manner of html controls in the WebBrowser control and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.