Re: How to catch WM_PAINT use Hook in Dialog?
m_hCallWndhook =
SetWindowsHookEx(WH_CALLWNDPROC,CallWndProc,/*NULL*/AfxGetApp()->m_hInstance
,GetCurrentThreadId());
LRESULT C***::CallWndProc(int nCode, WPARAM wParam, LPARAM lParam)
{
CWPSTRUCT* cwps = (CWPSTRUCT*)lParam;
if ( cwps->hwnd != m_pParentWnd->m_hWnd ) //if is not the Dialog ,
return.
return CallNextHookEx(m_hCallWndhook,nCode,wParam,lParam);
CString str;
str.Format("nCode:%d ,wParam:%d ,lParam:%d ,
message:0x%04X.\r\n",nCode,wParam,lParam,cwps->message);
//OutputDebugString(str);
if( cwps->message == WM_PAINT )
OutputDebugString(_T("----------------WM_PAINT .\r\n"));
if( cwps->message == WM_ERASEBKGND )
OutputDebugString(_T("----------------WM_ERASEBKGND
..\r\n"));
return CallNextHookEx(m_hCallWndhook, nCode, wParam, lParam);
}
"Tom Serface" <tom.nospam@camaswood.com>
??????:64390268-6EE2-4970-88EF-5814EB0F4A63@microsoft.com...
Could you post a bit of the code? Why are you trying to hook WM_PAINT
rather than just putting you code into the OnPaint() routine?
Tom
"green" <greenabc300@163.com> wrote in message
news:%23zbVbdypHHA.4120@TK2MSFTNGP06.phx.gbl...
Dear all,
I used WH_CALLWNDPROC,
but in the hook function, WM_PAINT can only catch once (only when dialog
'
Create'), Then OnPaint is called ,but in Hook function ,I do not catch
WM_PAINT.
Thanks
green
2007-06-05