1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef SHELL_ICON_MGR_H
#define SHELL_ICON_MGR_H
#ifdef _WIN32
#pragma once
#endif
class IShellIconMgrHelper
{
public:
virtual HINSTANCE GetHInstance() = 0;
virtual int WindowProc( void *hWnd, int uMsg, long wParam, long lParam ) = 0;
};
class CShellIconMgr
{
public:
CShellIconMgr();
~CShellIconMgr();
bool Init(
IShellIconMgrHelper *pHelper,
const char *pToolTip, // This must be allocated by the caller and must be valid as
// long as the CShellIconMgr exists.
int iCallbackMessage,
int iIconResourceID );
void Term();
void ChangeIcon( int iIconResourceID );
private:
void CreateTrayIcon();
LRESULT WindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
static LRESULT CALLBACK StaticWindowProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
HWND m_hWnd; // Invisible window to get timer and shell icon messages.
ATOM m_hWndClass;
UINT m_uTaskbarRestart; // This message is sent to us when the taskbar is created.
int m_iCurIconResourceID;
int m_iCallbackMessage;
const char *m_pToolTip;
IShellIconMgrHelper *m_pHelper;
};
#endif // SHELL_ICON_MGR_H
|