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

using MSHTL document without AxWebBrowser

Hi NG,

I would like to write a specific library that gets it data from a specific
webpage.
Because not all web sites are XHTML I guess I have to use the old com
library
MSHTML. Beacause it should be all done in the library without forms I cant
use
the AxWebBrowser ocx. Thats why I tried the following:
((IHTMLDocument2)hd).write("<html></html>");

((IHTMLDocument2)hd).close();

ihd2 = ((IHTMLDocument4)hd).createDocumentFromUrl(sURL, "null");

while(ihd2.readyState != "complete")

{

Thread.Sleep(0);

}

Unfortunally it seems, that the readystatechange event will never be fired.
Is that, because of

the missing ocx? I've also tried to attach the event. How would you
implement that?

Thanks

Thomas

Nov 16 '05 #1
3 3458
Thomas,

The code you are using is going to block, so I wouldn't recommend using
it.

Additionally, I the documentation for the readyState property states:

The IHTMLDocument2::readyState property enables the status of an object to
be tested. The correct place to test the IHTMLDocument2::readyState property
is in the event handler for onreadystatechange.

I would recommend attaching to the onreadystatechange event and then
continuing your work once it is loaded.

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

"Thomas Seidel" <th****@seidel.info> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi NG,

I would like to write a specific library that gets it data from a specific
webpage.
Because not all web sites are XHTML I guess I have to use the old com
library
MSHTML. Beacause it should be all done in the library without forms I cant
use
the AxWebBrowser ocx. Thats why I tried the following:
((IHTMLDocument2)hd).write("<html></html>");

((IHTMLDocument2)hd).close();

ihd2 = ((IHTMLDocument4)hd).createDocumentFromUrl(sURL, "null");

while(ihd2.readyState != "complete")

{

Thread.Sleep(0);

}

Unfortunally it seems, that the readystatechange event will never be fired. Is that, because of

the missing ocx? I've also tried to attach the event. How would you
implement that?

Thanks

Thomas


Nov 16 '05 #2
N.K
while(ih2.readystate!=complete)
Application.doEvents()

dirty/bad code .but might work.
"Thomas Seidel" <th****@seidel.info> wrote in message news:<#J**************@tk2msftngp13.phx.gbl>...
Hi NG,

I would like to write a specific library that gets it data from a specific
webpage.
Because not all web sites are XHTML I guess I have to use the old com
library
MSHTML. Beacause it should be all done in the library without forms I cant
use
the AxWebBrowser ocx. Thats why I tried the following:
((IHTMLDocument2)hd).write("<html></html>");

((IHTMLDocument2)hd).close();

ihd2 = ((IHTMLDocument4)hd).createDocumentFromUrl(sURL, "null");

while(ihd2.readyState != "complete")

{

Thread.Sleep(0);

}

Unfortunally it seems, that the readystatechange event will never be fired.
Is that, because of

the missing ocx? I've also tried to attach the event. How would you
implement that?

Thanks

Thomas

Nov 16 '05 #3
Good try. I use a console application, but added for testings
the reference to forms and that code.
Bud nothing happens. No event will be thrown. Look at my class file
in the other answer.
anyway, thanks

thomas
"N.K" <ni**********@hotmail.com> schrieb im Newsbeitrag
news:5b**************************@posting.google.c om...
while(ih2.readystate!=complete)
Application.doEvents()

dirty/bad code .but might work.
"Thomas Seidel" <th****@seidel.info> wrote in message

news:<#J**************@tk2msftngp13.phx.gbl>...
Hi NG,

I would like to write a specific library that gets it data from a specific webpage.
Because not all web sites are XHTML I guess I have to use the old com
library
MSHTML. Beacause it should be all done in the library without forms I cant use
the AxWebBrowser ocx. Thats why I tried the following:
((IHTMLDocument2)hd).write("<html></html>");

((IHTMLDocument2)hd).close();

ihd2 = ((IHTMLDocument4)hd).createDocumentFromUrl(sURL, "null");

while(ihd2.readyState != "complete")

{

Thread.Sleep(0);

}

Unfortunally it seems, that the readystatechange event will never be fired. Is that, because of

the missing ocx? I've also tried to attach the event. How would you
implement that?

Thanks

Thomas

Nov 16 '05 #4

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

Similar topics

0
by: AH | last post by:
Hi, I am trying to print a document from an instance of IE and then destroy the instance after the printing has completed. I use the following code to navigate to the page. object o = null;...
1
by: Mantorok | last post by:
Hi Is there anyway to get a WebBrowser to work without placing it on a form. I want to be able to instantiate a browser, complete some of the fields and submit, but whenever I try to navigate...
1
by: jokolee | last post by:
i was using component AxSHDocVw.AxWebBrowser,,but i rather confuces because when i write AxWebBrowser1.Document. the next option is Gettype function,,,nothing else...... But when i write...
0
by: sophocles the wise | last post by:
automatically post data & click buttons on sequence of web pages with AxWebBrowser Hi, I need to post stuff everyday to a website and am working on a VB program to do this for me. I am a...
6
by: ESmith | last post by:
I'm looking to user a web browser component in VS2005. I like the functionality in the AXWebBrowser component (from ActiveX controls page) that allows me to do this: mshtml.HTMLDocument doc; ...
0
by: sagar.jawale | last post by:
Hi, In my c# windows application, i am using AxSHDocVw.AxWebBrowser. I am displaying a generated receipt html in this browser. Also, for printing the same html, i am using the following command...
6
by: Dave Booker | last post by:
It appears that I cannot correctly install the AxWebBrowser in VS2005. I can instantiate an "AxWebBrowser browser" and refer to its members, properties, and methods. I'm having trouble with the...
4
by: Hexman | last post by:
Code below ---- I've asked a similar question on this forum earlier. This is a slightly different situation. Previous Question ---- I'm trying to save some specific web pages to disk as...
0
by: TeTe | last post by:
Hi I got problem with axwebbrowser + word. I'm opening Word document in AxWebBrowser and everything is OK until I run Word next to my App. Icons on taskbar are being disabled (in my App) and...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
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
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.