Skip to content

Commit 2c96f03

Browse files
committed
メッセージIDをクラス定数にする
1 parent ad0d4dc commit 2c96f03

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

sakura_core/_main/CControlTray.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ LRESULT CControlTray::DispatchEvent(
369369
LPARAM lParam // second message parameter
370370
)
371371
{
372+
const auto hWnd = hwnd;
373+
372374
int nId;
373375
HWND hwndWork;
374376
LPHELPINFO lphi;
@@ -1030,18 +1032,18 @@ LRESULT CControlTray::DispatchEvent(
10301032
case MYWM_ALLOWACTIVATE:
10311033
::AllowSetForegroundWindow(wParam);
10321034
return 0L;
1035+
10331036
default:
1034-
// << 20010412 by aroka
1035-
// Apr. 24, 2001 genta RegisterWindowMessageを使うように修正
1036-
if( uMsg == m_uCreateTaskBarMsg ){
1037-
/* TaskTray Iconの再登録を要求するメッセージ.
1038-
Explorerが再起動したときに送出される.*/
1039-
CreateTrayIcon( GetTrayHwnd() ) ;
1037+
// タスクバーが再作成されたときは、トレイアイコンを再登録する
1038+
if (gm_uMsgTaskbarCreated == uMsg) {
1039+
CreateTrayIcon(hWnd);
1040+
break; //あとはデフォルトに任せる
10401041
}
10411042
break; /* default */
1042-
// >> by aroka
10431043
}
1044-
return DefWindowProc( hwnd, uMsg, wParam, lParam );
1044+
1045+
//あとはデフォルトに任せる
1046+
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
10451047
}
10461048

10471049
/* WM_COMMANDメッセージ処理 */

sakura_core/_main/CControlTray.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ class CPropertyManager;
4646
*/
4747
class CControlTray
4848
{
49+
private:
50+
/*!
51+
* トレイアイコン再登録要求のメッセージID。
52+
*
53+
* Windows エクスプローラーが再起動したときに送出される。
54+
*
55+
* 独自メッセージは、システムグローバルな領域に登録される。
56+
* 同じ名前に対しては、同じメッセージIDが返される仕様なので
57+
* init only のグローバル定数とみなすことができる。
58+
*
59+
* @date 2001/04/24 genta
60+
*/
61+
static inline const UINT gm_uMsgTaskbarCreated = ::RegisterWindowMessageW(L"TaskbarCreated");
62+
4963
public:
5064
/*
5165
|| Constructors
@@ -125,8 +139,6 @@ class CControlTray
125139

126140
CImageListMgr m_hIcons;
127141

128-
UINT m_uCreateTaskBarMsg = ::RegisterWindowMessageW(L"TaskbarCreated"); //!< RegisterMessageで得られるMessage IDの保管場所。Apr. 24, 2001 genta
129-
130142
SFilePath m_szLanguageDll = nullptr;
131143
};
132144

0 commit comments

Comments
 (0)