• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            牽著老婆滿街逛

            嚴以律己,寬以待人. 三思而后行.
            GMail/GTalk: yanglinbo#google.com;
            MSN/Email: tx7do#yahoo.com.cn;
            QQ: 3 0 3 3 9 6 9 2 0 .

            SkinSB皮膚滾動條庫的一個幫助頭文件

            從哪里獲取到SkinSB?
                你可以從作者的博客里面獲取到相關信息:http://blog.csdn.net/mynamelj/archive/2009/02/16/3895585.aspx

            從哪里獲取Detours?
                它依賴著微軟的一個很暴力的庫Detours,可以從微軟的網站上獲取到:http://research.microsoft.com/en-us/projects/detours/


            官方網站上Detours最新版本是2.1,而SkinSB原生用的是1.5的版本的,這兩個版本的API差異還是很大的,所以頭文件對此做了一個橋接,以下為頭文件的代碼:


            #ifndef __SkinsbHelper_H__
            #define __SkinsbHelper_H__


            // 包含頭文件
            #include "detours.h"
            #include 
            "skinsb.h"


            #if defined(_DEBUG)
                #pragma comment(lib, 
            "skinsb.lib")
                #pragma comment(lib, 
            "detours.lib")
            #else
                #pragma comment(lib, 
            "skinsb.lib")
                #pragma comment(lib, 
            "detours.lib")
            #endif


            //////////////////////////////////////////////////////////////////////////
            // 申明鉤子
            //////////////////////////////////////////////////////////////////////////
            #if (DETOURS_VERSION >= 20100)
                
            int (WINAPI* SetScrollInfoT) (HWND, int, LPCSCROLLINFO, BOOL) = SetScrollInfo;
                BOOL (WINAPI
            * GetScrollInfoT) (HWND, int, LPSCROLLINFO) = GetScrollInfo;
                
            int (WINAPI* SetScrollPosT) (HWND, intint, BOOL) = SetScrollPos;
                
            int (WINAPI* GetScrollPosT) (HWND, int= GetScrollPos;
                BOOL (WINAPI
            * GetScrollRangeT) (HWND, int, LPINT, LPINT) = GetScrollRange;
                BOOL (WINAPI
            * SetScrollRangeT) (HWND, intintint, BOOL) = SetScrollRange;
                BOOL (WINAPI
            * ShowScrollBarT) (HWND, int, BOOL) = ShowScrollBar;
                BOOL (WINAPI
            * EnableScrollBarT) (HWND, UINT, UINT) = EnableScrollBar;
            #else
                DETOUR_TRAMPOLINE(
            int   WINAPI SetScrollInfoT(HWND, int, LPCSCROLLINFO, BOOL), SetScrollInfo)
                DETOUR_TRAMPOLINE(BOOL  WINAPI GetScrollInfoT(HWND, 
            int, LPSCROLLINFO), GetScrollInfo)
                DETOUR_TRAMPOLINE(
            int   WINAPI SetScrollPosT(HWND, intint, BOOL), SetScrollPos)
                DETOUR_TRAMPOLINE(
            int   WINAPI GetScrollPosT(HWND, int), GetScrollPos)
                DETOUR_TRAMPOLINE(BOOL  WINAPI GetScrollRangeT(HWND, 
            int, LPINT, LPINT), GetScrollRange)
                DETOUR_TRAMPOLINE(BOOL  WINAPI SetScrollRangeT(HWND, 
            intintint, BOOL), SetScrollRange)
                DETOUR_TRAMPOLINE(BOOL  WINAPI ShowScrollBarT(HWND, 
            int, BOOL), ShowScrollBar)
                DETOUR_TRAMPOLINE(BOOL  WINAPI EnableScrollBarT(HWND, UINT, UINT), EnableScrollBar)
            #endif


            int WINAPI SetScrollInfoD(HWND hwnd, int fnBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
            {
                
            if( SkinSB_IsValid(hwnd) )
                    
            return SkinSB_SetScrollInfo(hwnd, fnBar, lpsi, bRedraw);
                
            else
                    
            return SetScrollInfoT(hwnd, fnBar, lpsi, bRedraw);
            }


            BOOL WINAPI GetScrollInfoD(HWND hwnd, 
            int fnBar, LPSCROLLINFO lpsi)
            {
                
            if( SkinSB_IsValid(hwnd) )
                    
            return SkinSB_GetScrollInfo(hwnd, fnBar, lpsi);
                
            else
                    
            return GetScrollInfoT(hwnd, fnBar, lpsi);
            }


            int WINAPI SetScrollPosD(HWND hwnd, int nBar, int nPos, BOOL bRedraw)
            {
                
            if( SkinSB_IsValid(hwnd) )
                    
            return SkinSB_SetScrollPos(hwnd, nBar, nPos, bRedraw);
                
            else
                    
            return SetScrollPosT(hwnd, nBar, nPos, bRedraw);
            }


            int WINAPI GetScrollPosD(HWND hwnd, int nBar)
            {
                
            if( SkinSB_IsValid(hwnd) )
                    
            return SkinSB_GetScrollPos(hwnd, nBar);
                
            else
                    
            return GetScrollPosT(hwnd, nBar);
            }


            BOOL WINAPI SetScrollRangeD(HWND hwnd, 
            int nBar, int nMinPos, int nMaxPos, BOOL bRedraw)
            {
                
            if( SkinSB_IsValid(hwnd) )
                    
            return SkinSB_SetScrollRange(hwnd, nBar, nMinPos, nMaxPos, bRedraw);
                
            else
                    
            return SetScrollRangeT(hwnd, nBar, nMinPos, nMaxPos, bRedraw);
            }


            BOOL WINAPI GetScrollRangeD(HWND hwnd, 
            int nBar, LPINT lpMinPos, LPINT lpMaxPos)
            {
                
            if( SkinSB_IsValid(hwnd) )
                    
            return SkinSB_GetScrollRange(hwnd, nBar, lpMinPos, lpMaxPos);
                
            else
                    
            return GetScrollRangeT(hwnd, nBar, lpMinPos, lpMaxPos);
            }


            BOOL WINAPI ShowScrollBarD(HWND hwnd, 
            int nBar, BOOL bShow)
            {
                
            if( SkinSB_IsValid(hwnd) )
                    
            return SkinSB_ShowScrollBar(hwnd, nBar, bShow);
                
            else
                    
            return ShowScrollBarT(hwnd, nBar, bShow);
            }


            BOOL WINAPI EnableScrollBarD(HWND hwnd, UINT wSBflags, UINT wArrows)
            {
                
            if( SkinSB_IsValid(hwnd) )
                    
            return SkinSB_EnableScrollBar(hwnd, wSBflags, wArrows);
                
            else
                    
            return EnableScrollBarT(hwnd, wSBflags, wArrows);
            }



            //////////////////////////////////////////////////////////////////////////
            /// 注冊鉤子
            //////////////////////////////////////////////////////////////////////////

            LONG RegisterSkinSB(VOID)
            {
            #if (DETOURS_VERSION >= 20100)
                DetourTransactionBegin();
                DetourUpdateThread(GetCurrentThread());
                
            // 加載鉤子
                ::DetourAttach(&(PVOID&)SetScrollInfoT, SetScrollInfoD);
                ::DetourAttach(
            &(PVOID&)GetScrollInfoT, GetScrollInfoD);
                ::DetourAttach(
            &(PVOID&)SetScrollPosT, SetScrollPosD);
                ::DetourAttach(
            &(PVOID&)GetScrollPosT, GetScrollPosD);
                ::DetourAttach(
            &(PVOID&)SetScrollRangeT, SetScrollRangeD);
                ::DetourAttach(
            &(PVOID&)GetScrollRangeT, GetScrollRangeD);
                ::DetourAttach(
            &(PVOID&)ShowScrollBarT, ShowScrollBarD);
                ::DetourAttach(
            &(PVOID&)EnableScrollBarT, EnableScrollBarD);
                
            return DetourTransactionCommit();
            #else
                ::DetourFunctionWithTrampoline((PBYTE)SetScrollInfoT, (PBYTE)SetScrollInfoD);
                ::DetourFunctionWithTrampoline((PBYTE)GetScrollInfoT, (PBYTE)GetScrollInfoD);
                ::DetourFunctionWithTrampoline((PBYTE)SetScrollPosT, (PBYTE)SetScrollPosD);
                ::DetourFunctionWithTrampoline((PBYTE)GetScrollPosT, (PBYTE)GetScrollPosD);
                ::DetourFunctionWithTrampoline((PBYTE)SetScrollRangeT, (PBYTE)SetScrollRangeD);
                ::DetourFunctionWithTrampoline((PBYTE)GetScrollRangeT, (PBYTE)GetScrollRangeD);
                ::DetourFunctionWithTrampoline((PBYTE)ShowScrollBarT, (PBYTE)ShowScrollBarD);
                ::DetourFunctionWithTrampoline((PBYTE)EnableScrollBarT, (PBYTE)EnableScrollBarD);
                
            return 1;
            #endif
            }



            //////////////////////////////////////////////////////////////////////////
            /// 注銷鉤子
            //////////////////////////////////////////////////////////////////////////

            LONG UnRegisterSkinSB(VOID)
            {
            #if (DETOURS_VERSION >= 20100)    
                
            // 卸載鉤子
                ::DetourDetach(&(PVOID&)SetScrollInfoT, SetScrollInfoD);
                ::DetourDetach(
            &(PVOID&)GetScrollInfoT, GetScrollInfoD);
                ::DetourDetach(
            &(PVOID&)SetScrollPosT, SetScrollPosD);
                ::DetourDetach(
            &(PVOID&)GetScrollPosT, GetScrollPosD);
                ::DetourDetach(
            &(PVOID&)SetScrollRangeT, SetScrollRangeD);
                ::DetourDetach(
            &(PVOID&)GetScrollRangeT, GetScrollRangeD);
                ::DetourDetach(
            &(PVOID&)ShowScrollBarT, ShowScrollBarD);
                ::DetourDetach(
            &(PVOID&)EnableScrollBarT, EnableScrollBarD);
            #else
                ::DetourRemove((PBYTE)SetScrollInfoT, (PBYTE)SetScrollInfoD);
                ::DetourRemove((PBYTE)SetScrollPosT, (PBYTE)SetScrollPosD);
                ::DetourRemove((PBYTE)GetScrollInfoT, (PBYTE)GetScrollInfoD);
                ::DetourRemove((PBYTE)GetScrollPosT, (PBYTE)GetScrollPosD);
                ::DetourRemove((PBYTE)SetScrollRangeT, (PBYTE)SetScrollRangeD);
                ::DetourRemove((PBYTE)GetScrollRangeT, (PBYTE)GetScrollRangeD);
                ::DetourRemove((PBYTE)ShowScrollBarT, (PBYTE)ShowScrollBarD);
                ::DetourRemove((PBYTE)EnableScrollBarT, (PBYTE)EnableScrollBarD);
            #endif
                
            return 1;
            }



            #endif

            在InitInstance()里面使用:RegisterSkinSB(),
            在RegisterSkinSB中使用;UnRegisterSkinSB().

            posted on 2010-10-28 14:34 楊粼波 閱讀(1211) 評論(0)  編輯 收藏 引用

            久久综合给合久久狠狠狠97色69| 久久久无码精品午夜| 久久精品免费全国观看国产| 久久精品国产WWW456C0M| 伊人久久大香线蕉无码麻豆 | 久久伊人五月天论坛| 亚洲七七久久精品中文国产 | 狠狠色丁香婷婷久久综合五月| 一本久道久久综合狠狠躁AV| 色偷偷久久一区二区三区| 久久精品国产亚洲av日韩| 国内精品久久久久久久久电影网| 久久精品成人欧美大片| 99精品伊人久久久大香线蕉| 2021最新久久久视精品爱| 99久久综合狠狠综合久久止| 中文精品久久久久人妻| 久久er国产精品免费观看2| 亚洲国产综合久久天堂| 久久本道伊人久久| 中文字幕人妻色偷偷久久| 国产精品嫩草影院久久| 久久国产精品无码HDAV| 久久无码专区国产精品发布| 久久se精品一区二区影院| 精品熟女少妇a∨免费久久| 国产精品99久久不卡| 久久99精品国产99久久| 久久久久国产精品熟女影院| 一本色道久久综合狠狠躁| 久久久久99精品成人片三人毛片 | a级毛片无码兔费真人久久| 2020久久精品亚洲热综合一本| 国产精品一区二区久久| 看久久久久久a级毛片| 久久成人国产精品免费软件| 国产精品久久久久蜜芽| 亚洲午夜久久久| 久久人人爽人人爽人人片av麻烦| 久久久精品波多野结衣| 久久久久亚洲AV无码专区网站 |