
LRESULT lr=::CallWindowProc(pSkin- >m_funOldProc,hwnd,msg,wp,lp) ĭWORD dwStyle=::GetWindowLong(hwnd,GWL_STYLE) HookWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)ĬSkinScrollWnd *pSkin=(CSkinScrollWnd*)GetWindowLong(hwnd,GWL_USERDATA) my hook proc would hook nothing except some control-depending interfaces. But with spy++'s aid, I found if the window's client area need not update, For example, WM_ERESEBKGND and WM_PAINT. I have tried to hook some messages so as to update scrollinfo timely. it will update scrollbar's information at times. M_funOldProc=(WNDPROC)SetWindowLong(pWnd- >m_hWnd,GWL_WNDPROC,(LONG)HookWndProc) SetWindowLong(pWnd- >m_hWnd,GWL_USERDATA,(LONG) this) Remark: use this code, obviously, you will never try to use userdata!! attach CSkinScrollWnd data to target window's userdata. M_wndLimit.Create(NULL, " LIMIT",WS_CHILD|WS_VISIBLE,CRect( 0, 0, 0, 0), this, 200) " SkinScrollBarFrame",dwFrmStyle,rcFrm,pParent,uID) This- >CreateEx(dwFrmStyleEx,AfxRegisterWndClass(NULL), set its ID equal to original window's ID. create frame window at original window's rectangle and Int nBorder=::GetSystemMetrics(SM_CXEDGE) PWnd- >ModifyStyleEx(WS_EX_CLIENTEDGE, 0) Int nBorder=::GetSystemMetrics(SM_CXBORDER) If(dwStyle&WS_VISIBLE) dwFrmStyle|=WS_VISIBLE remove original window's border style and add it to frame window OffsetRect(&rcWnd,-rcWnd.left,-rcWnd.top) calc scrollbar wid/hei according to the input bitmap handle BOOL CSkinScrollWnd::SkinWindow(CWnd *pWnd,HBITMAP hBmpScroll)
