77 loop ( i, m_cwfmMap.GetSize() )
79 delete m_cwfmMap.Ref(i).val;
81 if ( m_pCwfmOldFrame != NULL )
83 delete m_pCwfmOldFrame;
84 m_pCwfmOldFrame = NULL;
94 void Hook(
bool isDisableVista =
false)
99 if ( g_pCwfmMaster == NULL )
101 static CReject s_cRejeCWFM;
104 g_pCwfmMaster->m_hCwfmCbtHook = ::SetWindowsHookEx(WH_CBT, ms_HookCbtProc, NULL, ::GetCurrentThreadId());
115 if ( g_pCwfmMaster != NULL )
117 delete g_pCwfmMaster;
118 g_pCwfmMaster = NULL;
134 static LRESULT CALLBACK ms_HookCbtProc(
int nCode, WPARAM wParam, LPARAM lParam)
136 WINDOWINFO wi = {
sizeof(WINDOWINFO) };
137 HWND hWnd =
reinterpret_cast<HWND
>(wParam);
138 ::GetWindowInfo(hWnd, &wi);
139 LONG style = wi.dwStyle;
141 bool canAttach =
true;
143 canAttach &= ((style & (WS_DLGFRAME)) == WS_DLGFRAME);
144 if ( wi.atomWindowType == 0x8002 ) { canAttach =
true; }
145 if ( wi.atomWindowType == 0xC23B ) { canAttach =
true; }
146 if ( wi.atomWindowType == 0xC16A ) { canAttach =
true; }
148 if ( wi.atomWindowType == 0xC037 && styleEx== 0x000000A8 )
153 if ( nCode == HCBT_CREATEWND )
156 if ( wi.atomWindowType == 0x8000 && styleEx== 0x181 )
161 if ( nCode == HCBT_CREATEWND )
167 if ( nCode == HCBT_CREATEWND )
170 TTRACE3(
"HCBT_CREATEWND : hWnd = 0x%08X, atom=%04X, ex=0x%08X\n", hWnd, wi.atomWindowType, wi.dwExStyle);
171 TTRACE2(
" style = 0x%08X \n", wi.dwStyle, ff.
ToString());
174 TTRACE1(
" -> Not Attach [0x%08X]\n", hWnd);
183 if ( ! g_pCwfmMaster->m_cwfmMap.HasKey(hWnd) )
187 g_pCwfmMaster->m_cwfmMap[hWnd] = P;
189 CBT_CREATEWND* pCBT =
reinterpret_cast<CBT_CREATEWND*
>(lParam);
190 if ( pCBT->lpcs->hMenu == NULL || wi.atomWindowType == 0xC256 )
199 if ( g_pCwfmMaster->m_cwfmMap.HasKey(hWnd) )
209 case HCBT_DESTROYWND:
210 if ( g_pCwfmMaster->m_pCwfmOldFrame != NULL )
212 delete g_pCwfmMaster->m_pCwfmOldFrame;
213 g_pCwfmMaster->m_pCwfmOldFrame = NULL;
215 if ( g_pCwfmMaster->m_cwfmMap.HasKey(hWnd) )
218 g_pCwfmMaster->m_pCwfmOldFrame = P;
219 g_pCwfmMaster->m_cwfmMap.RemoveKey(hWnd);
225 return ::CallNextHookEx(g_pCwfmMaster->m_hCwfmCbtHook, nCode, wParam, lParam);
228 HHOOK m_hCwfmCbtHook;
#define loop(VAR, CNT)
loop構文.
CStr ToString(void) const
[取得] 文字列化.
BOOL PostMessage(UINT message, WPARAM wParam, LPARAM lParam)
[処理] PostMessage.
bool Attach(HWND hWnd)
[設定] アタッチ
HWND GetSafeHwnd(void) const
[取得] ウィンドウハンドル取得
EOsVersion GetOsVersion(void) const
[取得] OSバージョン取得
~CCustomWindowFrameMaster(void)
デストラクタ
CCustomWindowFrameMaster(void)
コンストラクタ
static void Unhook(void)
[設定] アンフック.
void Hook(bool isDisableVista=false)
[設定] フック.
CCustomWindowFrame(void)
コンストラクタ
void CopyParameter(const CCustomWindowFrame &o)
[設定] 設定の複製.