Displaying popups correctly?
- From: "Software Development" <a.loeffler@xxxxxx>
- Date: 22 Apr 2005 03:18:58 -0700
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
.
- Prev by Date: SHAutoComplete and history
- Next by Date: How to ensure that web page is loaded completely?
- Previous by thread: SHAutoComplete and history
- Next by thread: How to ensure that web page is loaded completely?
- Index(es):
Relevant Pages
|
|