Re: How to catch WM_PAINT use Hook in Dialog?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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@xxxxxxxxxxxxx>
??????:64390268-6EE2-4970-88EF-5814EB0F4A63@xxxxxxxxxxxxxxxx
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@xxxxxxx> wrote in message
news:%23zbVbdypHHA.4120@xxxxxxxxxxxxxxxxxxxxxxx
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





.



Relevant Pages

  • Re: How to Inherit a Keypress?
    ... I have some difficulty with the logic in the routine. ... MouseHookStruct pointed to by lParam. ... You might want to consider a construction similar to that ... wParam, lParam); ...
    (comp.lang.pascal.delphi.misc)
  • Re: CListCtrl derived Class OnDestroy
    ... Krish wrote: ... int GetNextSelectedItem const; ... WPARAM wParam, LPARAM lParam); ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: CListCtrl derived Class OnDestroy
    ... void OnDestroy; ... int GetNextSelectedItem const; ... WPARAM wParam, LPARAM lParam); ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: CListCtrl derived Class OnDestroy
    ... void OnDestroy; ... int GetNextSelectedItem const; ... WPARAM wParam, LPARAM lParam); ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: CListCtrl derived Class OnDestroy
    ... void OnDestroy; ... int GetNextSelectedItem const; ... WPARAM wParam, LPARAM lParam); ...
    (microsoft.public.windowsce.embedded.vc)