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

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

  • In this webinar, IDC featured speaker Steve Conway, Vice President of High Performance Computing, will present an update on the global x86 HPC cluster market. The presentation will include IDC's five-year forecast for the medium- to large-scale technical computing and data analysis emerging markets by systems, processors and application middleware. Cray's featured speaker, John Lee, Vice President of Cray Cluster Advanced Technology Systems, will present the new Cray® CS400™ cluster series based on …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds