Click here to Skip to main content
15,883,901 members
Articles / Desktop Programming / MFC

FindFirstChangeNotification & Shell_NotifyIcon together... again

Rate me:
Please Sign up or sign in to vote.
4.81/5 (21 votes)
10 Oct 2007CPOL7 min read 59K   1.4K   42  
A brief description on how to monitor folder changes and get notification via the taskbar's "icon tray"
#if !defined(AFX_FAXWATCHDLG_H__AD168A76_B3B2_468F_8CC0_1CA44B5885FA__INCLUDED_)
#define AFX_FAXWATCHDLG_H__AD168A76_B3B2_468F_8CC0_1CA44B5885FA__INCLUDED_

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

/////////////////////////////////////////////////////////////////////////////
// CFaxWatchDlg dialog

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

// Dialog Data
	//{{AFX_DATA(CFaxWatchDlg)
	enum { IDD = IDD_FAXWATCH_DIALOG };
	CButton	m_xbSubfolders;
	CButton	m_btnOK;
	CEdit	m_ebFolder;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFaxWatchDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CFaxWatchDlg)
	virtual void OnOK();
	virtual BOOL OnInitDialog();
    afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnDestroy();
	afx_msg void OnChangeFolder();
	//}}AFX_MSG
    afx_msg LRESULT OnTrayIcon( WPARAM, LPARAM );    
    afx_msg LRESULT OnSetNotifyText( WPARAM, LPARAM );
    afx_msg LRESULT OnTaskbarCreated( WPARAM, LPARAM );
	DECLARE_MESSAGE_MAP()

    NOTIFYICONDATA m_niData;
    CEvent m_event;
    CWinThread *m_pWinThread;

    void RestoreWindow( void );
    void CreateMonitoringThread( void );
    static UINT ThreadFunc( LPVOID pParam );
};

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

#endif // !defined(AFX_FAXWATCHDLG_H__AD168A76_B3B2_468F_8CC0_1CA44B5885FA__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)


Written By
Software Developer (Senior) Pinnacle Business Systems
United States United States

The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.

HTTP 404 - File not found
Internet Information Services

Comments and Discussions