🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1400

Re: How to properly wait for TCPPWebbrowser to be ready...

#1400
From: Remy Lebeau (TeamB)
Date: Mon, 29 Jan 2007 18:46
40 lines
2446 bytes
"Tom" <tom@nospam.net> wrote in message
news:45bdf8f5$1@newsgroups.borland.com...

> I've got everything working as it stands, however the program is
> jumping to 99% cpu usage when it's waiting for the browser to
> finish it's action.

That is because you are running a tight unyielding loop that doesn't
allow other threads to access the CPU.

> What I'd like to know, is how to wait without being such a hog.

You need to call Application->ProcessMessages() periodically in your
loop.  Maybe also Sleep() as well.

Also, your loop is checking for a blank "display" property, which may
not always be blank, even when the div disappears.  It might be
getting set to "none" instead of "".

Amsuming the page is using an XMLHttpRequest object, you could try
hooking its onreadystatechange event, and then query its readystate
property when it changes to see when the tansmission is finished (or
just query the readystate in a loop instead of using an event).  You
can also retrieve the data of the response, if needed.

> I load up a web page, then using the IHTMLDocument3 I get
> access to the controls I need by Id and modify them. When
> that's done I use the click() function to submit the form.

The OnDocumentComplete event is the most ideal place for that logic.

> I've also noticed the program appears to be locked up during this
> loop.

Of course.  Because you are not allowing any new messages to be
processed.


Gambit
Technical Details
Message-ID: <45be40e9$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!208.48.142.85!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <45bdf8f5$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,d1b56cd84b3a485d
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <45bdf8f5$1@newsgroups.borland.com>
Subject: Re: How to properly wait for TCPPWebbrowser to be ready...
Date: Mon, 29 Jan 2007 10:46:16 -0800
Lines: 42
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 75.83.34.171
Message-ID: <45be40e9$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1170096361 75.83.34.171 (29 Jan 2007 10:46:01 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!208.48.142.85!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail