Skip to content

Instantly share code, notes, and snippets.

Created Mar 26, 2017
What would you like to do?
Option Explicit
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Const IID_IDownloadManager = "{988934A4-064B-11D3-BB80-00104B35E7F9}"
Private Declare PtrSafe _
Function IIDFromString Lib "ole32.dll" ( _
ByVal lpsz As LongPtr, _
ByRef lpiid As GUID _
) As Long
Private Declare PtrSafe _
Function IUnknown_QueryService Lib "shlwapi.dll" ( _
ByVal punk As IUnknown, _
ByRef guidService As GUID, _
ByRef riid As GUID, _
ByRef ppvOut As Any _
) As Long
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Const url = ""
Sub hoge()
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate url
While ie.busy Or ie.ReadyState <> 4
Sleep 1&
Dim hr&, iid As GUID
hr = IIDFromString(StrPtr(IID_IDownloadManager), iid)
Debug.Print Hex$(hr)
Dim unk As IUnknown
hr = IUnknown_QueryService(ie, iid, iid, unk)
Debug.Print Hex$(hr)
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment