'API等
Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Declare PtrSafe Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( _
ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, _
ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Const BM_CLICK As Long = &HF5
Sub PressButton()
Dim parentHwnd As Long
Dim childHwnd1 As Long
Dim childHwnd2 As Long
Dim childHwnd3 As Long
' 親ウィンドウのハンドルを取得
parentHwnd = FindWindow("classFoxitPhantom", vbNullString)
' 子ウィンドウハンドルを取得
childHwnd1 = FindWindowEx(parentHwnd, 0, vbNullString, vbNullString)
childHwnd2 = FindWindowEx(childHwnd1, 1, "#32770", vbNullString)
childHwnd3 = FindWindowEx(childHwnd2, 0, "Button", "結合")
' ボタン押下
Call SendMessage(childHwnd3, BM_CLICK, 0, 0)
End Sub