Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Adding Icons to the System Tray

, 2 Aug 2003
A class for adding icons to the system tray
hatrsystemtray.zip
systemtraysdk_demo.zip
SystemTraySDK_demo
Release
TaskbarDemo.exe
res
icon1.ico
icon2.ico
icon3.ico
icon4.ico
TaskbarDemo.ICO
TaskbarDemo.dsp
TaskbarDemo.dsw
systemtray_demo.zip
systemtray_demo
Release
SystemTrayDemo.exe
RES
Cmdbar.bmp
icon1.ico
icon2.ico
icon3.ico
icon4.ico
SystemTrayDemo.ico
SystemTrayDemoDoc.ico
Toolbar.bmp
SystemTrayDemo.dsp
SystemTrayDemo.dsw
SystemTrayDemoCE.dsp
SystemTrayDemoCE.dsw
systemtray_src.zip
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAINFRM_H__E2B26DD7_886E_11D1_9BF5_00A0243D1382__INCLUDED_)
#define AFX_MAINFRM_H__E2B26DD7_886E_11D1_9BF5_00A0243D1382__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#ifdef USING_NONMFC_TRAY  // This is set in project settings
#include "SystemTraySDK.h"
#else
#include "SystemTray.h"
#endif

class CMainFrame : public CFrameWnd
{
public:
	CMainFrame();
	DECLARE_DYNCREATE(CMainFrame)

// Attributes
public:
	CSystemTray m_TrayIcon;

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMainFrame)
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CMainFrame();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

// Generated message map functions
protected:
	//{{AFX_MSG(CMainFrame)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    afx_msg void OnAnimate();
	afx_msg void OnShowIcon();
	afx_msg void OnHideIcon();
	afx_msg void OnMoveToRight();
	afx_msg void OnShowBalloon();
	afx_msg void OnUpdateHideIcon(CCmdUI* pCmdUI);
	afx_msg void OnUpdateShowBalloon(CCmdUI* pCmdUI);
	afx_msg void OnUpdateMoveToRight(CCmdUI* pCmdUI);
	afx_msg void OnUpdateShowIcon(CCmdUI* pCmdUI);
	afx_msg void OnUpdateSetFocus(CCmdUI* pCmdUI);
	afx_msg void OnSetFocusToIcon();
	afx_msg void OnClose();
	afx_msg void OnDemoMaximise();
	afx_msg void OnUpdateDemoMaximise(CCmdUI* pCmdUI);
	afx_msg void OnDemoMinimise();
	afx_msg void OnUpdateDemoMinimise(CCmdUI* pCmdUI);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MAINFRM_H__E2B26DD7_886E_11D1_9BF5_00A0243D1382__INCLUDED_)

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)

Share

About the Author

Chris Maunder
Founder CodeProject
Canada Canada
Chris is the Co-founder, Administrator, Architect, Chief Editor and Shameless Hack who wrote and runs The Code Project. He's been programming since 1988 while pretending to be, in various guises, an astrophysicist, mathematician, physicist, hydrologist, geomorphologist, defence intelligence researcher and then, when all that got a bit rough on the nerves, a web developer. He is a Microsoft Visual C++ MVP both globally and for Canada locally.
 
His programming experience includes C/C++, C#, SQL, MFC, ASP, ASP.NET, and far, far too much FORTRAN. He has worked on PocketPCs, AIX mainframes, Sun workstations, and a CRAY YMP C90 behemoth but finds notebooks take up less desk space.
 
He dodges, he weaves, and he never gets enough sleep. He is kind to small animals.
 
Chris was born and bred in Australia but splits his time between Toronto and Melbourne, depending on the weather. For relaxation he is into road cycling, snowboarding, rock climbing, and storm chasing.
Follow on   Twitter   Google+   LinkedIn

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 3 Aug 2003
Article Copyright 1999 by Chris Maunder
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid