VC中修改IE网页滚动条的颜色和样式?

时间:2023-01-26 23:35:17
按照MSDN和网上搜集的资料我实现了如下的代码:
HRESULT STDMETHODCALLTYPE CWebCtrlInterFace::GetHostInfo(DOCHOSTUIINFO *pInfo)
{
if (m_defaultDocHostUIHandler != NULL)
return m_defaultDocHostUIHandler->GetHostInfo(pInfo);
else
{
pInfo->cbSize = sizeof(DOCHOSTUIINFO);
if (m_nStyle)
{
pInfo->dwFlags = DOCHOSTUIFLAG_NO3DBORDER|DOCHOSTUIFLAG_SCROLL_NO;
}
else
{
WCHAR* szCSS = L"<STYLE>\
BODY{ \
SCROLLBAR-FACE-COLOR: #00000;  \
SCROLLBAR-HIGHLIGHT-COLOR: #FF0000;\
SCROLLBAR-SHADOW-COLOR: #00FF00; \
SCROLLBAR-3DLIGHT-COLOR:#53670D;    \
SCROLLBAR-ARROW-COLOR: #53670D; \
SCROLLBAR-TRACK-COLOR: #D4E597;      \
                SCROLLBAR-DARKSHADOW-COLOR: #53670D; \
SCROLLBAR-BASE-COLOR: #fcfcfc }\
</STYLE>";

size_t cchlengthCSs;
HRESULT hr = StringCchLengthW(szCSS, CCHMAX, &cchlengthCSs);
OLECHAR* pCSSBuffer = (OLECHAR*)CoTaskMemAlloc((cchlengthCSs+1)*sizeof(OLECHAR));

hr = StringCchCopyW(pCSSBuffer, cchlengthCSs+1, szCSS);
pInfo->pchHostCss = pCSSBuffer;
 
pInfo->dwFlags = DOCHOSTUIFLAG_NO3DBORDER;                  
}
pInfo->dwDoubleClick = DOCHOSTUIDBLCLK_DEFAULT;
return S_OK;
}

但修改后还是没有效果,请教大神们应该怎样的修改网页中的颜色和样式

4 个解决方案

#1


这么长时间啦,没有一个回答的! VC中修改IE网页滚动条的颜色和样式?

#2


你的IE 浏览器用的是 那种, ActiveX 控件?还是别的?我不太懂,但你说出来可能有人明白

#3


[code=c]HRESULT CMyHtmlView::OnGetHostInfo(DOCHOSTUIINFO *pInfo)
{
     pInfo->cbSize = sizeof(DOCHOSTUIINFO);

    WCHAR* szCSS = L"BODY{SCROLLBAR-FACE-COLOR: #00000;  \
                    SCROLLBAR-HIGHLIGHT-COLOR: #FF0000;\
                    SCROLLBAR-SHADOW-COLOR: #00FF00; \
                    SCROLLBAR-3DLIGHT-COLOR:#53670D;    \
                    SCROLLBAR-ARROW-COLOR: #53670D; \
                    SCROLLBAR-TRACK-COLOR: #D4E597;      \
                    SCROLLBAR-DARKSHADOW-COLOR: #53670D; \
                    SCROLLBAR-BASE-COLOR: #fcfcfc }";

    size_t cchlengthCSs;
    HRESULT hr = StringCchLengthW(szCSS, wcslen(szCSS) * 2, &cchlengthCSs);
    OLECHAR* pCSSBuffer = (OLECHAR*)CoTaskMemAlloc((cchlengthCSs+1)*sizeof(OLECHAR));

    hr = StringCchCopyW(pCSSBuffer, cchlengthCSs+1, szCSS);
    pInfo->pchHostCss = pCSSBuffer;                 

    pInfo->dwDoubleClick = DOCHOSTUIDBLCLK_DEFAULT;
    return S_OK;
}/code]

#4


HRESULT CMyHtmlView::OnGetHostInfo(DOCHOSTUIINFO *pInfo)
{
     pInfo->cbSize = sizeof(DOCHOSTUIINFO);

    WCHAR* szCSS = L"BODY{SCROLLBAR-FACE-COLOR: #00000;  \
                    SCROLLBAR-HIGHLIGHT-COLOR: #FF0000;\
                    SCROLLBAR-SHADOW-COLOR: #00FF00; \
                    SCROLLBAR-3DLIGHT-COLOR:#53670D;    \
                    SCROLLBAR-ARROW-COLOR: #53670D; \
                    SCROLLBAR-TRACK-COLOR: #D4E597;      \
                    SCROLLBAR-DARKSHADOW-COLOR: #53670D; \
                    SCROLLBAR-BASE-COLOR: #fcfcfc }";

    size_t cchlengthCSs;
    HRESULT hr = StringCchLengthW(szCSS, wcslen(szCSS) * 2, &cchlengthCSs);
    OLECHAR* pCSSBuffer = (OLECHAR*)CoTaskMemAlloc((cchlengthCSs+1)*sizeof(OLECHAR));

    hr = StringCchCopyW(pCSSBuffer, cchlengthCSs+1, szCSS);
    pInfo->pchHostCss = pCSSBuffer;                 

    pInfo->dwDoubleClick = DOCHOSTUIDBLCLK_DEFAULT;
    return S_OK;
}

#1


这么长时间啦,没有一个回答的! VC中修改IE网页滚动条的颜色和样式?

#2


你的IE 浏览器用的是 那种, ActiveX 控件?还是别的?我不太懂,但你说出来可能有人明白

#3


[code=c]HRESULT CMyHtmlView::OnGetHostInfo(DOCHOSTUIINFO *pInfo)
{
     pInfo->cbSize = sizeof(DOCHOSTUIINFO);

    WCHAR* szCSS = L"BODY{SCROLLBAR-FACE-COLOR: #00000;  \
                    SCROLLBAR-HIGHLIGHT-COLOR: #FF0000;\
                    SCROLLBAR-SHADOW-COLOR: #00FF00; \
                    SCROLLBAR-3DLIGHT-COLOR:#53670D;    \
                    SCROLLBAR-ARROW-COLOR: #53670D; \
                    SCROLLBAR-TRACK-COLOR: #D4E597;      \
                    SCROLLBAR-DARKSHADOW-COLOR: #53670D; \
                    SCROLLBAR-BASE-COLOR: #fcfcfc }";

    size_t cchlengthCSs;
    HRESULT hr = StringCchLengthW(szCSS, wcslen(szCSS) * 2, &cchlengthCSs);
    OLECHAR* pCSSBuffer = (OLECHAR*)CoTaskMemAlloc((cchlengthCSs+1)*sizeof(OLECHAR));

    hr = StringCchCopyW(pCSSBuffer, cchlengthCSs+1, szCSS);
    pInfo->pchHostCss = pCSSBuffer;                 

    pInfo->dwDoubleClick = DOCHOSTUIDBLCLK_DEFAULT;
    return S_OK;
}/code]

#4


HRESULT CMyHtmlView::OnGetHostInfo(DOCHOSTUIINFO *pInfo)
{
     pInfo->cbSize = sizeof(DOCHOSTUIINFO);

    WCHAR* szCSS = L"BODY{SCROLLBAR-FACE-COLOR: #00000;  \
                    SCROLLBAR-HIGHLIGHT-COLOR: #FF0000;\
                    SCROLLBAR-SHADOW-COLOR: #00FF00; \
                    SCROLLBAR-3DLIGHT-COLOR:#53670D;    \
                    SCROLLBAR-ARROW-COLOR: #53670D; \
                    SCROLLBAR-TRACK-COLOR: #D4E597;      \
                    SCROLLBAR-DARKSHADOW-COLOR: #53670D; \
                    SCROLLBAR-BASE-COLOR: #fcfcfc }";

    size_t cchlengthCSs;
    HRESULT hr = StringCchLengthW(szCSS, wcslen(szCSS) * 2, &cchlengthCSs);
    OLECHAR* pCSSBuffer = (OLECHAR*)CoTaskMemAlloc((cchlengthCSs+1)*sizeof(OLECHAR));

    hr = StringCchCopyW(pCSSBuffer, cchlengthCSs+1, szCSS);
    pInfo->pchHostCss = pCSSBuffer;                 

    pInfo->dwDoubleClick = DOCHOSTUIDBLCLK_DEFAULT;
    return S_OK;
}