Click here to Skip to main content
15,886,518 members
Articles / Programming Languages / C++

CTrayIcon - System Tray Icon Wrapper

Rate me:
Please Sign up or sign in to vote.
3.17/5 (14 votes)
6 Jun 20078 min read 175.2K   5K   47  
An article exhibiting a wrapper class for System Taskbar icon.
// CTrayIconDemoDlg.h : header file
//

#if !defined(AFX_CTRAYICONDEMODLG_H__3E1CD20A_74CE_47A0_8FC2_A4490A4F18FC__INCLUDED_)
#define AFX_CTRAYICONDEMODLG_H__3E1CD20A_74CE_47A0_8FC2_A4490A4F18FC__INCLUDED_

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

#include "TrayIcon.h"
#include "afxwin.h"

/////////////////////////////////////////////////////////////////////////////
// CCTrayIconDemoDlg dialog

class CCTrayIconDemoDlg : public CDialog
{

// Construction
public:
	CCTrayIconDemoDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CCTrayIconDemoDlg)
	enum { IDD = IDD_CTRAYICONDEMO_DIALOG };
		// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCTrayIconDemoDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Declarying CTrayIcon object pointer for adding an icon to the system tray notification area
	CTrayIcon* m_pTrayIcon;
	
	// Generated message map functions
	//{{AFX_MSG(CCTrayIconDemoDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnAbout();
	virtual void OnCancel();
	afx_msg void OnShow();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedBtnhideicon();
	afx_msg void OnBnClickedBtnshowicon();
	afx_msg void OnBnClickedBtnstartani();
	afx_msg void OnBnClickedBtnstopani();
	afx_msg void OnBnClickedBtnminimize();
	CButton m_ctrlStopAni;
	CButton m_ctrlStartAni;
	CButton m_ctrlShowIcon;
	CButton m_ctrlHideIcon;	
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CTRAYICONDEMODLG_H__3E1CD20A_74CE_47A0_8FC2_A4490A4F18FC__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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Pakistan Pakistan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions