Skip to content

Instantly share code, notes, and snippets.

@kumatti1
Created February 15, 2017 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kumatti1/8d7dcd00cc19841389163873de884e81 to your computer and use it in GitHub Desktop.
Save kumatti1/8d7dcd00cc19841389163873de884e81 to your computer and use it in GitHub Desktop.
Option Explicit
Private Declare PtrSafe _
Function IUnknown_GetWindow Lib "shlwapi.dll" ( _
ByVal punk As IUnknown, _
ByRef phwnd As LongPtr _
) As Long
Const WM_LBUTTONDOWN = &H201
Private Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, lParam As Any) As LongPtr
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub hoge()
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate "https://www.google.co.jp/"
While ie.Busy Or ie.ReadyState <> 4
Sleep 1&
Wend
Dim hwnd As LongPtr
IUnknown_GetWindow ie.Document, hwnd
SendMessage hwnd, WM_LBUTTONDOWN, 0, 10 * &H10000 Or 10
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment