mWebbrowser.bas
资源名称:IE_VB.rar [点击查看]
上传用户:davilee3
上传日期:2015-04-22
资源大小:986k
文件大小:3k
源码类别:
浏览器
开发平台:
Visual Basic
- Attribute VB_Name = "mWebbrowser"
- Option Explicit
- ' URL clipboard format
- Public CF_URL As Integer
- ' Html clipboard format
- Public CF_HTML As Integer
- ' Interface IDs
- Public IID_IInternetSecurityManager As olelib.UUID
- Public IID_IElementBehaviorFactory As olelib.UUID
- Public IID_IUnknown As olelib.UUID
- Public CGID_DocHostCommandHandler As olelib.UUID
- ' Class IDs
- Public CLSID_WebBrowser As olelib.UUID
- ' Command groups
- Public CGID_HTML As olelib.UUID
- ' TravelLog
- Public IID_ITravelLogStg As olelib.UUID
- Public IID_ITravelLogEntry As olelib.UUID
- Public IID_IEnumTravelLogEntry As olelib.UUID
- Public SID_STravelLogCursor As olelib.UUID
- Public IID_IServiceProvider As olelib.UUID
- 'IDownloadManager
- Public IID_IDownloadManager As olelib.UUID
- ' APIs
- Declare Function MulDiv Lib "kernel32" ( _
- ByVal Mul As Long, _
- ByVal Nom As Long, _
- ByVal Den As Long) As Long
- Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal Str As Any) As Long
- Sub Initialize()
- ' Register the CF_URL format
- CF_URL = (RegisterClipboardFormat(CFSTR_SHELLURL) And &H7FFF&) Or &H8000
- 'Register the CF_HTML format
- CF_HTML = (RegisterClipboardFormat("HTML Format") And &H7FFF&) Or &H8000
- ' Convert CLSIDs, IIDs and CGIDs
- ' WebBrowser control class
- CLSIDFromString "{8856F961-340A-11D0-A96B-00C04FD705A2}", CLSID_WebBrowser
- ' Interface IDs
- CLSIDFromString IIDSTR_IUnknown, IID_IUnknown
- CLSIDFromString IIDSTR_IInternetSecurityManager, IID_IInternetSecurityManager
- CLSIDFromString olelib.CGIDSTR_DocHostCommandHandler, CGID_DocHostCommandHandler
- ' Command groups
- CLSIDFromString CGIDSTR_HTML, CGID_HTML
- 'TravelLog
- CLSIDFromString "{7EBFDD87-AD18-11d3-A4C5-00C04F72D6B8}", IID_ITravelLogEntry
- CLSIDFromString "{7EBFDD85-AD18-11d3-A4C5-00C04F72D6B8}", IID_IEnumTravelLogEntry
- CLSIDFromString "{7EBFDD80-AD18-11d3-A4C5-00C04F72D6B8}", IID_ITravelLogStg
- CLSIDFromString "{7EBFDD80-AD18-11d3-A4C5-00C04F72D6B8}", SID_STravelLogCursor
- CLSIDFromString "{6d5140c1-7436-11ce-8034-00aa006009fa}", IID_IServiceProvider
- 'IDownloadManager
- CLSIDFromString "{988934A4-064B-11D3-BB80-00104B35E7F9}", IID_IDownloadManager
- End Sub
- Function Str2Ptr(ByRef Str As String) As Long
- ' Allocate memory for the string
- Str2Ptr = CoTaskMemAlloc(LenB(Str) + 2)
- ' Copy the string
- MoveMemory ByVal Str2Ptr, ByVal StrPtr(Str), LenB(Str) + 2
- End Function
- Function Pix2HM(ByVal Value As Long) As Long
- Pix2HM = MulDiv(Value, 2540, 1440) * Screen.TwipsPerPixelX
- End Function
- Function HM2Pix(ByVal Value As Long) As Long
- HM2Pix = MulDiv(Value, 1440, 2540) / Screen.TwipsPerPixelX
- End Function