Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 716807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:20:28+00:00 2026-05-14T05:20:28+00:00

Is there another way to load MSHTML documents without use Application.ProcessMessages? To load a

  • 0

Is there another way to load MSHTML documents without use Application.ProcessMessages?

To load a document into a IHTMLDocument I need to do this:

while Doc.readyState <> 'complete' do 
   Application.ProcessMessages;

I want not to process all the message queue during the loading, because I would be changing my application flow, in other words, some messages that should be processed after the loading to be completed can be processed earlier, even before the loading end.

There is a special message code that the IHTMLDocument expect to advance in the loading process? Or there is another way to load?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:20:28+00:00Added an answer on May 14, 2026 at 5:20 am

    The call to Application.ProcessMessages is most likely just needed to allow the MSHTML activeX control time to finish loading the document. It sounds like they’re using cooperative multitasking here to simulate loading the doc in the background – the ActiveX posts messages to itself to process the next chunk or whatever.

    Normally, this wouldn’t affect your app’s flow because the doc load would happen as part of your normal message loop. But because you’re wanting to load the doc synchronously (not do anything else until the doc is fully loaded), you’re sensitive to the way it’s doing background loading via messages.

    One solution: see if you can remove the requirement to load the doc synchronously. Let the load happen when it happens, but move the check for readState = complete into a timer, perhaps on a 1 second interval. When the timer discovers the doc load is complete, then fire off your downstream food chain activities.

    Another solution: Display a modal dialog while waiting for the doc to load. This has the benefit of disabling the rest of your UI so you don’t run the risk of reentrancy. Calling ProcessMessages means the user can still interact with your window, click on buttons, menus etc. Usually this will lead to problems. Displaying a modal dialog (“progress dialog?”) avoids reentrancy by disabling everything behind the modal dialog.

    Third possibility: Replace Application.ProcessMessages with PeekMessage and logic to examine the message to decide whether to let it go through or put it back on the message queue for later. This is a bit dirty but might work in very special cases.

    I recommend approach #2, the modal dialog.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there another way to do this Query ? $query = SELECT * FROM
There's another way to write this code ? I think it's kinda unprofessional and
Is there another way to find out the status of services on AppEngine other
Is there another way to connect to a MySQL database with what came included
Is there another way to run a regular JS function with parameters passed than
Isn't there another way of using global variables in a Java stlye manner in
I have a working selector but I just wondered whether there was another way
i read somewhere before, there is another way to perform the if-else statement, the
I'm familiar with: Convert.ToInt32(texthere); But is there another cleaner way to do it? I
How would I determine the current server load? Do I need to use JMX

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.