// // AUTHOR // Stef Walter // // LICENSE // This software is in the public domain. // // The software is provided "as is", without warranty of any kind, // express or implied, including but not limited to the warranties // of merchantability, fitness for a particular purpose, and // noninfringement. In no event shall the author(s) be liable for any // claim, damages, or other liability, whether in an action of // contract, tort, or otherwise, arising from, out of, or in connection // with the software or the use or other dealings in the software. // // SUPPORT // Send bug reports to: // #ifndef __MONITORDLG_H_ #define __MONITORDLG_H_ #include "resource.h" // main symbols #include "trayicon.h" #define WM_TRAYICON (WM_APP + 38L) #include "regsettings.h" #include "persistwinpos.h" #define TIME_LAPSE 4000 #define LAPSE_PER_MIN 15 #define CHARS_PER_WORD 544 #define CHARS_MULTIPLE 100 ///////////////////////////////////////////////////////////////////////////// // CMonitorDlg class CMonitorDlg : public CDialogImpl, public CPersistPosWindow { public: CMonitorDlg(); ~CMonitorDlg(); enum { IDD = IDD_MONITORDLG }; BEGIN_MSG_MAP(CMonitorDlg) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) COMMAND_HANDLER(IDC_ONTOP, BN_CLICKED, OnTop) COMMAND_ID_HANDLER(IDOK, OnOK) COMMAND_ID_HANDLER(IDCANCEL, OnCancel) MESSAGE_HANDLER(WM_TIMER, OnTimer) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) COMMAND_ID_HANDLER(ID_TRAY_EXIT, OnExit) COMMAND_ID_HANDLER(ID_TRAY_SHOW, OnShow) MESSAGE_HANDLER(WM_TRAYICON, OnTrayIcon) END_MSG_MAP() // Handler prototypes: // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); LRESULT OnTop(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnShow(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); LRESULT OnExit(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); // Notification from Icon LRESULT OnTrayIcon(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { return m_Icon.OnTrayNotification(wParam, lParam); } protected: bool CreateIcon(long lSpeed, long lAverage); long GetAverage(long lSpeed); HICON m_hIcon; SIZE m_szIcon; CImageList m_imgList; CTrayIcon m_Icon; // Icon in Shell Tray CRegSettings m_settings; // Our registry key long m_aSpeeds[LAPSE_PER_MIN]; int m_nIndex; }; #endif //__MONITORDLG_H_