Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Add Status Bar to Property Sheet

Posted on 1999-07-27
Medium Priority
Last Modified: 2012-06-27
How do you add a status bar to a property sheet?
Question by:jzry9x
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 23

Expert Comment

ID: 1201161
the process is same as adding status bar to mainframe of aplication. In this case you will create and attach the status bar in OnInitDialog function of your property sheet, like they way it is done in mainframe's OnCreate function.
LVL 23

Accepted Solution

naveenkohli earned 200 total points
ID: 1201162
Here is the sample code which will add and place status bar on a property sheet. See the code used to make room for placing the status bar. You can manipulate it to adjust the distance of bar from the bottom of sheet. Now you wil have to add the UPDATE handles for all the indicators urself..

static UINT indicators[] =
      ID_SEPARATOR,           // status line indicator

BOOL CDemoPSheet::OnInitDialog()
      BOOL bResult = CPropertySheet::OnInitDialog();

      // Create the status bar..and set the indicators..
      if (!m_wndStatusBar.Create(this) ||
            TRACE0("Failed to create status bar\n");
            return -1;      // fail to create

      // Make a sunken or recessed border around the first pane
      m_wndStatusBar.SetPaneInfo(0, m_wndStatusBar.GetItemID(0),
            SBPS_STRETCH, NULL );

      CRect sheetRect;
      CRect barRect;

      // Get the client coordinates of the propertysheet.
      GetClientRect (&sheetRect);

      // Query for the rectangle coordinates when the status bar will be placed. This
      // will help in determining the height of staus bar.
            0, reposQuery, barRect);

      int barHeight = (sheetRect.Height () -barRect.Height ());

      // Get the position of one of the buttons on sheet. Its coordinates will be used to
      // calculate the distance between the bottom of the sheet and buttons.
      CWnd *pWnd = GetDlgItem (IDOK);
      CRect okRect;
      pWnd->GetWindowRect (okRect);
      ScreenToClient (okRect);

      int heightOfBtnsFromBottom = sheetRect.bottom - okRect.bottom;

      // Now we will have to expand to propertysheet to make room for the status
      // bar. By default, the staus bar will be postioned at the bottom of the
      // property sheet window and it will overlap the buttons. So what we will do
      // is add the bar height and distance of buttons to calculate new position for
      // sheet.
      sheetRect.bottom += (2 * barHeight + heightOfBtnsFromBottom);
      MoveWindow (sheetRect, FALSE);

      // Now place the status bar.
      CenterWindow ();

      return FALSE;

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question