Toolbar and Statusbar on Dialog

Environment: VC6 , Windows 98

This is an example of creating a Toolbar and Statusbar on a Dialog Window. I came across some project (I cannot remember by whom) and thought of developing a more Windows-like project.

Code for Creation of Toolbar

  m_pImageList = new CImageList;
  SetupImages(m_pImageList);

  TBBUTTON tb;

  m_ToolBar = new CToolBarCtrl;
  m_ToolBar->Create(WS_CHILD|WS_VISIBLE|WS_BORDER|TBSTYLE_FLAT,
    CRect(0,0,0,0), this, 0);

  m_ToolBar->SetImageList(m_pImageList);
  tb.iBitmap = 0;
  tb.iString = NULL;
  tb.fsState = TBSTATE_ENABLED;
  tb.fsStyle = TBSTYLE_BUTTON;
  tb.idCommand = ID_HELP_ABOUT;

  m_ToolBar->AddButtons(1, &tb);
  tb.iBitmap = 1;
  tb.idCommand = ID_BOLD;
  m_ToolBar->AddButtons(1, &tb);
  tb.iBitmap = 2;
  tb.idCommand = ID_DRAWING;
  m_ToolBar->AddButtons(1, &tb);

  TBBUTTON tb1;
  tb1.fsStyle = TBSTYLE_SEP;
  m_ToolBar->AddButtons(1, &tb1);

  tb.iBitmap = 3;
  tb.idCommand = ID_STRIKEOUT;
  tb.iString = NULL;
  m_ToolBar->AddButtons(1, &tb);

Code for Creation of Statusbar

  m_StatusBar = new CStatusBarCtrl;
  m_StatusBar->Create(WS_CHILD|WS_VISIBLE|SBT_OWNERDRAW,
    CRect(0,0,0,0), this, 0);

  int strPartDim[4]= {180, 260, 340, -1};
  m_StatusBar->SetParts(4, strPartDim);

  m_StatusBar->SetText(_T("Dialog / StatusBar / Toolbar"),0,0);
  m_StatusBar->SetText(_T("Example"), 1, 0);

  CString string;
  string.LoadString(IDS_MYCOMPUTER);
  m_StatusBar->SetText(string, 3 ,SBT_NOBORDERS   );
  m_StatusBar->SetIcon(3, 
               SetIcon(AfxGetApp()->LoadIcon(IDI_COMP),
               FALSE));

Downloads

Download demo project - 22 Kb



Comments

  • Article not found

    Posted by r-gimilio on 02/11/2007 01:50pm

    No download available for demo project.

    Reply
  • Latest Updates

    Posted by barretto_vn on 03/15/2005 08:46am

    for updates to this and more of my articles go to http://members.lycos.co.uk/barrettovn Barretto VN

    Reply
  • Pop-up and messages in the status bar first pane

    Posted by Legacy on 11/30/2003 12:00am

    Originally posted by: Raymond Gimilio

    The example given works fine. But now, we need to make the systems displays string table messages and popups when setting the mouse pointer on a push button or a menu item.

    What is the entry of the labyrinth for ? Were can we go to find an example. We were workin some weeks on the MSDN sample Dlgbcr32 who is rather complicated.

    Reply
  • move windowsize?

    Posted by Legacy on 04/15/2003 12:00am

    Originally posted by: Nico Gr�ner

    ok that is good away nevertheless which is if I means windows in the size of other one would like?  Is there for it also a solution?
    
    

    MfG Nico

    Reply
  • But this toolbar can't attach any aside, how to?

    Posted by Legacy on 10/10/2002 12:00am

    Originally posted by: xyx

    But this toolbar can't attach any aside, how to?

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • 10 Rules that Make or Break Enterprise App Development Projects In today's app-driven world, application development is a top priority. Even so, 68% of enterprise application delivery projects fail. Designing and building applications that pay for themselves and adapt to future needs is incredibly difficult. Executing one successful project is lucky, but making it a repeatable process and strategic advantage? That's where the money is. With help from our most experienced project leads and software engineers, …

  • IT decision support impacts all aspects of technology management, from governance and strategy to budgets and resource planning. IT decision support effectiveness often falls prey to data-driven challenges that make it difficult to understand the data in context. These challenges: overwhelming data volumes, heterogeneous data types, and growing data complexity. This Forrester Consulting Paper reports the three key findings from their study conducted, on behalf of BDNA, to test the hypothesis that data …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds