MCPcopy Create free account
hub / github.com/ColorCop/ColorCop / Create

Method Create

ColorCop/SystemTray.cpp:88–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88BOOL CSystemTray::Create(CWnd* pParent, UINT uCallbackMessage, LPCTSTR szToolTip,
89 HICON icon, UINT uID) {
90 m_bEnabled = TRUE;
91
92 // Make sure we avoid conflict with other messages
93 ASSERT(uCallbackMessage >= WM_USER);
94
95 // Tray only supports tooltip text up to 64 characters
96 ASSERT(_tcslen(szToolTip) <= 64);
97
98 // Create an invisible window
99 CWnd::CreateEx(0, AfxRegisterWndClass(0), _T(""), WS_POPUP, 0, 0, 10, 10, NULL, 0);
100
101 // load up the NOTIFYICONDATA structure
102 m_tnd.cbSize = sizeof(NOTIFYICONDATA);
103 m_tnd.hWnd = pParent->GetSafeHwnd()? pParent->GetSafeHwnd() : m_hWnd;
104 m_tnd.uID = uID;
105 m_tnd.hIcon = icon;
106 m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
107 m_tnd.uCallbackMessage = uCallbackMessage;
108
109 _tcscpy_s(m_tnd.szTip, szToolTip);
110
111 // Set the tray icon
112 VERIFY(m_bEnabled = Shell_NotifyIcon(NIM_ADD, &m_tnd));
113 return m_bEnabled;
114}
115
116CSystemTray::~CSystemTray() {
117 RemoveIcon();

Callers 2

OnInitDialogMethod · 0.80
SetupTrayIconMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected