Private
Declare
Function
FindWindow
Lib
"user32"
Alias
"FindWindowA"
(
ByVal
lpClassName
As
String
,
ByVal
lpWindowName
As
String
)
As
Long
Private
Declare
Function
FindWindowEx&
Lib
"user32"
_
Alias
"FindWindowExA"
(
ByVal
hWndParent
As
Long
,
ByVal
hWndChildAfter
As
Long
,
ByVal
lpClassName
As
String
,
ByVal
lpWindowName
As
String
)
Private
Declare
Function
SendMessage
Lib
"user32.dll"
Alias
"SendMessageA"
(
ByVal
hwnd
As
Long
,
ByVal
wMsg
As
Long
,
ByVal
wParam
As
Long
,
ByRef
lParam
As
Any)
As
Long
Private
Declare
Function
PostMessage
Lib
"user32.dll"
Alias
"PostMessageA"
(
ByVal
hwnd
As
Long
,
ByVal
wMsg
As
Long
,
ByVal
wParam
As
Long
,
ByVal
lParam
As
Long
)
As
Long
Private
Declare
Function
apiShowWindow
Lib
"user32"
Alias
"ShowWindow"
_
(
ByVal
hwnd
As
Long
,
ByVal
nCmdShow
As
Long
)
As
Long
Private
Const
WM_SETTEXT = &HC
Private
Const
BM_CLICK = &HF5
Private
Sub
CommandButton1_Click()
Dim
IE1
As
InternetExplorer
Set
IE1 =
New
InternetExplorer
IE1.Visible =
True
apiShowWindow IE1.hwnd, 3
IE1.navigate SsilkaFile
Do
While
(IE1.readyState <> 4)
And
(IE1.readyState <> 3): DoEvents:
Loop
While
IE1.document
Is
Nothing
: DoEvents: Wend
Application.Wait (Now + TimeValue(
"0:00:5"
))
IE1.ExecWB 4, 1
Application.Wait (Now + TimeValue(
"0:00:2"
))
Dim
hwnd, hwndEdit, hwndEx, hwndBtnSave
As
Long
hwnd = FindWindow(vbNullString,
"Сохранение"
)
hwndEx = FindWindowEx(hwnd, 0,
"DUIViewWndClassName"
, vbNullString)
hwndEx = FindWindowEx(hwndEx, 0,
"DirectUIHWND"
, vbNullString)
hwndEx = FindWindowEx(hwndEx, 0,
"FloatNotifySink"
, vbNullString)
hwndEx = FindWindowEx(hwndEx, 0,
"ComboBox"
, vbNullString)
hwndEx = FindWindowEx(hwndEx, 0,
"Edit"
, vbNullString)
SendMessage hwndEx, WM_SETTEXT, 0,
ByVal
"e:\999.pdf"
hwndBtnSave = FindWindowEx(hwnd, 0,
"Button"
,
"Со&хранить"
)
PostMessage hwndBtnSave, BM_CLICK, 0, 0
IE1.Quit
End
Sub