Click here to Skip to main content
15,881,757 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 174.7K   5K   47  
An article exhibiting a wrapper class for System Taskbar icon.
// TrayIconMouseMsgHandler.h : header file

#pragma once

class CTrayIconMouseMsgHandler;

// Synomym for CTrayIconMouseMsgHandler pointer
typedef CTrayIconMouseMsgHandler* MouseMsgHandlerPtr;

// CTrayIconMouseMsgHandler

class CTrayIconMouseMsgHandler: public CObject
{
public:

	// Single paramenter constructor, a mosue message identfier has to be passed
	CTrayIconMouseMsgHandler(unsigned int uMouseMsgID)
	{
		m_uMouseMsgID = uMouseMsgID;
	}

	// Pure-virtual callback mouse message handler, necessary to be implemented by the derived class, for handling system tray icon notifications.
	virtual void MouseMsgHandler() = 0;

	// Gets the mouse message identifier
	unsigned int GetMouseMsgID() const
	{
		return m_uMouseMsgID;
	}

	// Sets the mosue message identifier
	void SetMouseMsgID(unsigned int uMouseMsgID)
	{
		m_uMouseMsgID = uMouseMsgID;
	}

	// Virtual descturctor, to be implemented by the derived class if some clean-up has to be performed
	virtual ~CTrayIconMouseMsgHandler(){}

private:
	
	CTrayIconMouseMsgHandler(){}

	unsigned int m_uMouseMsgID;
};

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