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

  • Home
  • SEARCH
  • 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 652423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:16:14+00:00 2026-05-13T22:16:14+00:00

I have a small application which embeds webbrowser controls. In that application I have

  • 0

I have a small application which embeds webbrowser controls. In that application I have created a popup class. This popup is used to display server generated error messages.

I want to be able to resize the popup to suit the message. This is so a short message is not contained in an oversize form and a large message is not in an undersized form.

Rather than send a width and height I would like to calculate the dimensions on the fly. I also did not want to visibly resize the form, that is just plain ugly.

Everything I try fails 🙁

This is what I thought should work

create the form
move it offscreen by setting its left position to -1000
show the form (offscreen)
write the contents to the webrowser ctl
get the width and height after it renders
hide the form
resize the form to fit the above width and height
center it onscreen
show the form

That should work just great, except the webbrowser control refuses to render, therefore I can’t get the client width and height

Does anyone know how this can be done?

DC

  • 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-13T22:16:15+00:00Added an answer on May 13, 2026 at 10:16 pm

    I have solved the issue I was having. it was a timing one.

    the problem was I was writing content to the webbrowser control. And then attempting to read the width and height. but the control hadn’t rendered and so I was not getting those parameters.

    I realised this early in the piece so I instead put the resize code in the ondocumentcomplete event. sadly what I didn’t realise was this event is not called when you write directly to the document. somehow I managed to convince myself it wasn’t being called because the control was hidden. that was not the case.

    So once I managed to figure that out I put a message pump in after I called the write function and before I called the show function. the message pump looped around until the control returned complete (checks the readystate flag)

    PopUp->Write(text.c_str());
    while (!PopUp->Complete() && ProcessMessages()){ ; }
    popup_ctlDownloadComplete(0);
    

    now when the DownloadComplete event is called manually, the document has rendered and I can get the width and height.

    The code above could cause an infinite loop if there is an error so I have added a counter to kill it should that happen. just not shown for brevity and clarity.

    Oh and the code is legacy code not managed code

    DC

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

Sidebar

Ask A Question

Stats

  • Questions 316k
  • Answers 316k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Give this a try: option explicit dim fileSystem, folder, file… May 13, 2026 at 11:28 pm
  • Editorial Team
    Editorial Team added an answer I can only surmise that the problem was indeed with… May 13, 2026 at 11:28 pm
  • Editorial Team
    Editorial Team added an answer Install FireBug for Firefox. Enable FireBug. Enable the Net tab.… May 13, 2026 at 11:28 pm

Related Questions

I have an application that gets installed with a Wise installer (EDIT: Wise creates
I'm writting a small graphics program using directx9 which imports some model files created
I have a small application which can be used to set reminders for future
I have a small application which I created using jeweler. The jeweler generates a
I have a small application, which is free for personal use, but requires a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.