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

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

  • Packaged application development teams frequently operate with limited testing environments due to time and labor constraints. By virtualizing the entire application stack, packaged application development teams can deliver business results faster, at higher quality, and with lower risk.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds