Last active
November 16, 2020 02:28
-
-
Save kumatti1/7575516 to your computer and use it in GitHub Desktop.
InternetExplorerManager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
uuid(BF3EFD65-0A8E-45BE-87AF-77241926D874), | |
version(1.0), | |
helpstring ("hoge") | |
] | |
library hoge | |
{ | |
importlib("stdole2.tlb"); | |
interface IInternetExplorerManager; | |
typedef struct UUID { | |
long Data1; | |
short Data2; | |
short Data3; | |
unsigned char Data4[8]; | |
} UUID; | |
[ | |
object, | |
uuid(ACC84351-04FF-44F9-B23F-655ED168C6D5), // IID_IInternetExplorerManager | |
helpstring("IInternetExplorerManager Interface") | |
] | |
interface IInternetExplorerManager : IUnknown | |
{ | |
// CreateObject will create a browser object based on the dwConfig and the URL | |
HRESULT CreateObject([in] LONG dwConfig, // INTERNETEXPLORERCONFIGURATION enumeration | |
[in] LPWSTR pszURL, // The url that likely to be navigated to | |
[in, out] UUID * riid, // Interface identifier | |
[out, retval] IDispatch **ppv); // Get the point to the object instance | |
}; | |
[ | |
uuid(DF4FCC34-067A-4E0A-8352-4A1A5095346E), // CLSID_InternetExplorerManager | |
helpstring("Internet Explorer Manager"), | |
] | |
coclass InternetExplorerManager | |
{ | |
[default] interface IInternetExplorerManager; | |
}; | |
[ | |
dllname ("ole32.dll") | |
] | |
module API_ole32{ | |
[entry("IIDFromString")] | |
long IIDFromString( | |
[in] LPWSTR lpsz, | |
[in, out] UUID * lpiid); | |
}; | |
[dllname("Constants")] | |
module Constants | |
{ | |
const LPSTR IID_IWebBrowser2 = "{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}"; | |
}; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private WithEvents ie As SHDocVw.InternetExplorer | |
Sub test() | |
Dim pUnk As hoge.InternetExplorerManager | |
Set pUnk = New InternetExplorerManager | |
Dim hr As Long | |
Dim u As UUID | |
hr = hoge.IIDFromString(hoge.IID_IWebBrowser2, u) | |
Set ie = pUnk.CreateObject(1, vbNullString, u) | |
ie.Visible = True | |
ie.Navigate "http://www.yahoo.co.jp/" | |
While ie.Busy Or ie.ReadyState <> READYSTATE_COMPLETE | |
DoEvents | |
Wend | |
End Sub | |
Private Sub ie_NewProcess(ByVal lCauseFlag As Long, ByVal pWB2 As Object, Cancel As Boolean) | |
Debug.Print "ie_NewProcess" | |
End Sub | |
Private Sub ie_OnQuit() | |
Debug.Print "ie_OnQuit" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment