📄 ngtrayicon.h
字号:
////////////////////////////////////////////////////////////////
// CNGTrayIcon Copyright 1999 Microsoft Systems Journal.
// If this code works, it was written by Paul DiLascia.
// If not, I don't know who wrote it.
#ifndef _TRAYICON_H
#define _TRAYICON_H
#include "NGSubclass.h"
////////////////
// CNGTrayIcon manages an icon in the Windows 95 system tray.
// The sample program TRAYTEST shows how to use it.
//
class NGLIB_EXT_CLASS CNGTrayIcon : public CCmdTarget {
public:
CNGTrayIcon(UINT uID);
~CNGTrayIcon();
// Call this to receive tray notifications
void SetNotificationWnd(CWnd* pNotifyWnd, UINT uCbMsg);
// SetIcon functions. To remove icon, call SetIcon(0)
//
BOOL SetIcon(UINT uID); // main variant you want to use
BOOL SetIcon(HICON hicon, LPCTSTR lpTip);
BOOL SetIcon(LPCTSTR lpResName, LPCTSTR lpTip)
{ return SetIcon(lpResName ?
AfxGetApp()->LoadIcon(lpResName) : NULL, lpTip); }
BOOL SetStandardIcon(LPCTSTR lpszIconName, LPCTSTR lpTip)
{ return SetIcon(::LoadIcon(NULL, lpszIconName), lpTip); }
// Following is obsolete. CNGTrayIcon does default handling auotmatically.
// virtual LRESULT OnTrayNotification(WPARAM uID, LPARAM lEvent);
virtual LRESULT OnTrayNotify(WPARAM uID, LPARAM lEvent);
virtual LRESULT OnTaskBarCreate(WPARAM wp, LPARAM lp);
protected:
NOTIFYICONDATA m_nid; // struct for Shell_NotifyIcon args
// private class used to hook tray notification and taskbarcreated
class CTrayHook : public CNGSubclassWnd {
private:
CNGTrayIcon* m_pTrayIcon;
virtual LRESULT WindowProc(UINT msg, WPARAM wp, LPARAM lp);
friend CNGTrayIcon;
};
friend CTrayHook;
CTrayHook m_notifyHook; // trap tray notifications
CTrayHook m_parentHook; // trap taskbarcreated message
DECLARE_DYNAMIC(CNGTrayIcon)
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -