在XP操作系统下,在VB的webbrowser控件中的按钮等是没有XP风格的。下面的代码可以使webbrowser控件中的页面显示XP风格:
Private m_hMod As Long
Private m_hMod2 As Long
Private Declare Function InitCommonControlsEx Lib "comctl32.dll" (iccex As tagInitCommonControlsEx) As Boolean
Private Type tagInitCommonControlsEx
lngSize As Long
lngICC As Long
End Type
Private Const ICC_USEREX_CLASSES = &H200
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Sub Form_Initialize()
Dim iccex As tagInitCommonControlsEx
iccex.lngSize = LenB(iccex)
iccex.lngICC = ICC_USEREX_CLASSES
InitCommonControlsEx iccex
m_hMod = LoadLibrary("shell32.dll")
m_hMod2 = LoadLibrary("explorer.exe")
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate2 "http://www.google.com/"
End Sub
Private Sub Form_Terminate()
If m_hMod Then FreeLibrary m_hMod
If m_hMod2 Then FreeLibrary m_hMod2
End Sub