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 6334367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:38:45+00:00 2026-05-24T18:38:45+00:00

I am writing a browser helper object and want to show a child window

  • 0

I am writing a browser helper object and want to show a child window inside the internet explorer window to show the user some messages. I use DS_CONTROL and WS_CHILDWINDOW and want to get a behaviour similar to the message in this image: enter image description here

I succeeded in inserting and showing a child window, but the window is flickering and sometimes it’s visible and sometimes the website content is above the window in the z coordinate. I tried to set the child window as topmost window, but that didn’t change anything. How can I get the child window to be always visible until it is closed? Here is some source code I use:

resource.rc:

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "resource.h"
//
// Dialog resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_NOTIFICATIONBAR DIALOG 0, 0, 186, 95
STYLE DS_3DLOOK | DS_CONTROL | DS_MODALFRAME | DS_SYSMODAL | DS_SHELLFONT | WS_VISIBLE |  WS_CHILDWINDOW
EXSTYLE WS_EX_TOPMOST
FONT 8, "Ms Shell Dlg"
{
    DEFPUSHBUTTON   "OK", IDOK, 129, 7, 50, 14
    PUSHBUTTON      "Cancel", IDCANCEL, 129, 24, 50, 14
    LTEXT           "Static", IDC_STATIC, 25, 16, 68, 21, SS_LEFT
}

Dialog class:

#include "atlbase.h"
#include "atlwin.h"
#include "resources/resource.h"

class CMyDialog : public CDialogImpl<CMyDialog>
{
public:
   enum { IDD = IDD_NOTIFICATIONBAR };

   BEGIN_MSG_MAP(CMyDialog)
      MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
      COMMAND_HANDLER(IDCANCEL, BN_CLICKED, OnBnClickedCancel)
   END_MSG_MAP()

   CMyDialog() {Create(::GetActiveWindow());}

   ~CMyDialog() {DestroyWindow();}

   LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, 
      BOOL& /*bHandled*/)
   {
      // ::MessageBox(NULL,_T("OnInit"),_T("OnInit"),MB_ICONINFORMATION|MB_OK);
      // Do some initialization code
      return 1;
   }

   static CMyDialog &getInstance()
   {
       static CMyDialog dlg;
       return dlg;
   }
public:
   LRESULT OnBnClickedCancel(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
   {
       ShowWindow(SW_HIDE);
       return 0;
   }
};

Call:

CMyDialog &bar=CMyDialog::getInstance();
bar.ShowWindow(SW_SHOWNORMAL);
  • 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-24T18:38:46+00:00Added an answer on May 24, 2026 at 6:38 pm

    Finally I could solve it (with the help of the information I got from the many different answers below).

    For those of you having the same problem, here the solution:
    I have to shrink the window that is displaying the HTML website, so my own window doesn’t overlap with it.
    For this I get the current tab like in the example here.
    This tab window contains the html document window and the status bar.
    So I call FindWindowEx twice to get the HWNDs of those two windows:

    FindWindowEx(tab,NULL,_T("Shell DocObject View"),_T("")) //html document window
    FindWindowEx(tab,NULL,_T("msctls_statusbar32"),_T("")) //status bar
    

    Then I resize the document window so that it fills the whole client area except for the place taken by the status bar and the place taken by my dialog. Here is the code (webbrowser.getCurrentTabHwnd() is an implementation of the example here mentioned above. isShown is a variable indicating, if my dialog should be shown or not):

    CWindow tab(webbrowser.getCurrentTabHwnd());
    CWindow child(FindWindowEx(tab,NULL,_T("Shell DocObject View"),_T("")));
    CWindow statusbar(FindWindowEx(tab,NULL,_T("msctls_statusbar32"),_T("")));
    
    RECT statusbarrect;
    statusbar.GetWindowRect(&statusbarrect);
    RECT documentrect;
    tab.GetClientRect(&documentrect);
    documentrect.bottom-=(statusbarrect.bottom-statusbarrect.top);
    
    if(isShown)
    {
        //Request document window rect
        static const unsigned int DLGHEIGHT=50;
        RECT dialogrect=documentrect;
        documentrect.top+=DLGHEIGHT;
        dialogrect.bottom=dialogrect.top+DLGHEIGHT;
        //Shrink document window
        MoveWindow(&dialogrect);
    }
    
    child.MoveWindow(&documentrect);
    

    This piece of code now has to be called on each browser window resize and on dialog show/hide.

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

Sidebar

Related Questions

I am developing a Browser Helper Object running inside Internet Explorer. I am writing
I'm writing a Browser Helper Object (BHO) for Internet Explorer in C#! I want
I’m writing a BHO (Browser Helper Object) that catches the address the user enters
I'm busy writing a BHO(Browser Helper Object) in C# and I need to attach
I have a browser helper object on IE that have some clipboard history functions.
I am writing a Browser Helper Object for ie7, and I need to detect
I'm writing some browser side dynamic functionality and using HTTP Basic Auth to protect
I'm writing a simple program in C which opens an internet browser using the
I'm writing an app that's destined for the browser, and I want to write
A Browser Helper Plugin I'm writing at the moment (C++) needs a list of

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.