TRAYICON.H 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ////////////////////////////////////////////////////////////////
  2. // CTrayIcon Copyright 1996 Microsoft Systems Journal.
  3. //
  4. // If this code works, it was written by Paul DiLascia.
  5. // If not, I don't know who wrote it.
  6. #ifndef _TRAYICON_H
  7. #define _TRAYICON_H
  8. ////////////////
  9. // CTrayIcon manages an icon in the Windows 95 system tray.
  10. //
  11. class CTrayIcon : public CCmdTarget {
  12. protected:
  13. DECLARE_DYNAMIC(CTrayIcon)
  14. NOTIFYICONDATA m_nid; // struct for Shell_NotifyIcon args
  15. public:
  16. CTrayIcon(UINT uID);
  17. ~CTrayIcon();
  18. // Call this to receive tray notifications
  19. void SetNotificationWnd(CWnd* pNotifyWnd, UINT uCbMsg);
  20. // SetIcon functions. To remove icon, call SetIcon(0)
  21. //
  22. BOOL SetIcon(UINT uID); // main variant you want to use
  23. BOOL SetIcon(HICON hicon, LPCSTR lpTip);
  24. BOOL SetIcon(LPCTSTR lpResName, LPCSTR lpTip)
  25. { return SetIcon(lpResName ?
  26. AfxGetApp()->LoadIcon(lpResName) : NULL, lpTip); }
  27. BOOL SetStandardIcon(LPCTSTR lpszIconName, LPCSTR lpTip)
  28. { return SetIcon(::LoadIcon(NULL, lpszIconName), lpTip); }
  29. virtual LRESULT OnTrayNotification(WPARAM uID, LPARAM lEvent);
  30. };
  31. #endif