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

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • In support of their business continuity and disaster recovery plans, many midsized companies endeavor to avoid putting all their eggs in one basket. Understanding the critical role of last-mile connectivity and always available Internet access for their enterprises, savvy firms utilize redundant connections from multiple service providers. Despite the good intentions, their Internet connectivity risk may still be in a single basket. That is because internet service providers (ISPs) and competitive local …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds