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

Create Icons at Runtime and Show Them in the System Tray

, 10 Jun 2008 CPOL
Create dynamic icons at runtime and show them in the system tray
dynicon_demo.zip
DynIcon
DynIcon.exe
DynIcon
DynIcon.suo
res
DynIcon.ico
icon1.ico
dynicon_demo_cs.zip
DynIconCS
DynIconCS
DynIconCS.suo
bin
Release
DynIconCS.exe
DynIconCS.pdb
DynIconCS.vshost.exe
DynIconCS.csproj.user
Properties
Settings.settings
Resources
Icon1.ico
Icon1.ico
dynicon_demo_mfc.zip
DynIcon.exe
DynIcon.suo
DynIcon.ico
icon1.ico
// DynIconDlg.h : header file
//

#pragma once


#define TIMER1 1
#define WM_TRAY WM_APP + 1

#define ICON_VALUE1 1
#define ICON_VALUE2 2



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

// Dialog Data
	enum { IDD = IDD_DYNICON_DIALOG };

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


// Implementation
protected:
	HICON m_hIcon;

public:
	int m_nValue1;
	int m_nValue2;

	HICON m_hIcon1;
	HICON m_hIcon2;

	CString m_strTooltip;

	BOOL m_bActiv;
	BOOL m_bFirstDefaultIcon;
	BOOL m_bFirstIcon1;
	BOOL m_bFirstIcon2;

	void ChangeValues(void);
	
	void CreateIcons(void);
	void CreateIcon1(void);
	void CreateIcon2(void);

	void PushIcons(void);
	void PushIcon1(void);
	void PushIcon2(void);

	void ClearIcon1(void);
	void ClearIcon2(void);

	void SetDefaultIconInTray(void);
	void ClearDefaultIconInTray(void);


	LRESULT	OnTray(WPARAM wParam, LPARAM lParam);	

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

	DECLARE_MESSAGE_MAP()

	afx_msg void OnBnClickedOk();
	afx_msg void OnBnClickedStart();
	afx_msg void OnBnClickedStop();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	


};

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

Holger Lange

Germany Germany
No Biography provided

| Advertise | Privacy | Mobile
Web01 | 2.8.141015.1 | Last Updated 10 Jun 2008
Article Copyright 2007 by Holger Lange
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid