Click here to Skip to main content
15,896,296 members
Articles / Desktop Programming / MFC

Control Message Bar

Rate me:
Please Sign up or sign in to vote.
5.00/5 (47 votes)
23 Oct 2008CPOL10 min read 90.6K   3.4K   140  
Code to add a message bar to virtually any existing Windows control.
// CtrlMessageBarDemoDlg.h : header file
//

#pragma once

#include "CMBEdit.h"

#include "CtrlMessageBar.h"

// CCtrlMessageBarDemoDlg dialog
class CCtrlMessageBarDemoDlg : public CDialog
{
// Construction
public:
	CCtrlMessageBarDemoDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_CTRLMESSAGEBARDEMO_DIALOG };
	CTreeCtrl	m_tree;
	CListBox	m_listbox;
	CListCtrl	m_list;
	CCMBEdit	m_edit;
	CButton		m_btn;
	CCtrlMessageBar bar;
	CCtrlMessageBar barEdit;
	CCtrlMessageBar barBtn;
	CCtrlMessageBar barTree;
	CCtrlMessageBar barList;
	CCtrlMessageBar barListBox;

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	void AddInitialMessageBars();

	HICON m_hIcon;
	CImageList m_iml;
	CImageList m_imlLarge;
	CImageList m_imlMessage;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnReset();
	DECLARE_MESSAGE_MAP()
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
Originally from an electronics background, I moved into software in 1996, partly as a result of being made redundant, and partly because I was very much enjoying the small amount of coding (in-at-the-deep-end-C) that I had been doing!

I swiftly moved from C to C++, and learned MFC, and then went on to real-time C on Unix. After this I moved to the company for which I currently work, which specialises in Configuration Management software, and currently program mainly in C/C++, for Windows. I have been gradually moving their legacy C code over to use C++ (with STL, MFC, ATL, and WTL). I have pulled in other technologies (Java, C#, VB, COM, SOAP) where appropriate, especially when integrating with third-party products.

In addition to that, I have overseen the technical side of the company website (ASP, VBScript, JavaScript, HTML, CSS), and have also worked closely with colleagues working on other products (Web-based, C#, ASP.NET, SQL, etc).

For developing, I mainly use Visual Studio 2010, along with an in-house-designed editor based on Andrei Stcherbatchenko's syntax parsing classes, and various (mostly freeware) tools. For website design, I use Dreaweaver CS3.

When not developing software, I enjoy listening to and playing music, playing electric and acoustic guitars and mandolin.

Comments and Discussions