Displaying popups correctly?



Hello there,

I'm currently working on a browser application with C/C++ MFC (VS 2003)
which should also handle popup windows (like you see them all over the
web showing ads or information).

I also implemented the "OnClientToHostWindow" function in the event
sink map:

ON_EVENT( HtmlViewWin32, AFX_IDW_PANE_FIRST, 268, OnClientToHostWindow,
VTS_PI4 VTS_PI4 )

If a popup is created, I'll get an "OnNewWindow" notification followed
by "OnClientToHostWindow", which tells me the actual size of the popup
window.

This all works fine except the rendering of the window! If I ignore the
"OnClientToHostWindow" function, the popup window is much too big and
the content is displayed centered in the window. When I'm dragging the
window just by one pixel, the content moves to the upper left borders
of the window ...

So let's say I have a popup with 400 x 300 pixel and
"OnClientToHostWindow" gets called, I modify my window (mainframe):

// Hide menu
this->SetMenu( NULL );

DWORD style = GetStyle();

m_wndReBar.ShowWindow(SW_HIDE);
m_wndToolBar.ShowWindow(SW_HIDE);

ViewStatusBar(false);

CRect r;
GetWindowRect(r);
CRect r2;
GetClientRect(r2);

int dx = r.Width()-r2.Width();
int dy = r.Height()-r2.Height();
CRect r3(r.left,r.top,r.left+cx+dx,r.top+cy+dy);
MoveWindow(r3);

So the popup has now the correct size and position, all fine until now,
BUT: The whole window shows NO content, it's all white! If I'm resizing
the window with mouse just one pixel (regardless if x or y), it's
drawing the whole content correctly as from now. Invalidating /
redrawing of the window or reloading the popup content after modifiying
the window size / position didn't help. What I'm doing wrong?

Is there an example of handling / showing popups with CHtmlView out
there? The "mfcie" sample from MS does not help very much.

Thanks in advance,
Andy

.



Relevant Pages

  • Re: Iceweasel freezes and iceape vulnerabilities and instability
    ... popup is fixed in place within the browser window, ... the browser is doing its job; it is just possible to do some really ... Funny you mention this -- I don't think this is due to malicious code, ...
    (Debian-User)
  • RE: [PHP] Conditional popup driven from server-side
    ... otherwise display normal browser page. ... if there aren't errors then popup a modal ... window and start processing while displaying ... server, and then get the server to close it when done. ...
    (php.general)
  • Re: Avira AntiVir (free version) - Is this now adware?
    ... When I went to manually update, got an ad. Got back to the host this morning and saw another popup window with their ad. ... It could be wonderful cake but not if you occasionally get a turd smooshed into your face. ...
    (alt.comp.anti-virus)
  • Re: Avira AntiVir (free version) - Is this now adware?
    ... Seemed okay but it seems plagued with ads trying to get the user to buy into their premium version. ... When I went to manually update, got an ad. Got back to the host this morning and saw another popup window with their ad. ... It could be wonderful cake but not if you occasionally get a turd smooshed into your face. ...
    (alt.comp.anti-virus)
  • Popup hell !
    ... Go onto your hard drive and look for folders which have ... >noticed a new breed of popup begin to intrude itself. ... redirecting it away from the page I ... >sized popup window, I get my main browser window ...
    (microsoft.public.windows.inetexplorer.ie6.browser)