-
Solved: IE WindowsSize ??
Hi.
I Cant control Minimize/Normal protcess.
How control: if IE WindowsSize Minimized then do something.
[VBA]
Option Explicit
Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" _
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Public Enum apiShowWindowSize
SW_MAXIMIZE = 3
SW_SHOWNORMAL = 1
SW_sHOWMINIMIZED = 2
End Enum
Sub test()
Dim strSavePath As String
Dim URL As String, ext As String
Dim buf, Ret As Long
Dim objIE As Object
'Close All opened IE Windows??
Set objIE = CreateObject("InternetExplorer.Application")
'On Error GoTo errHandler
With objIE
.Navigate "http://somesite.com"
Do While .Busy: DoEvents: Loop
objIE.Visible = True
apiShowWindow objIE.hwnd, SW_SHOWNORMAL
'IE NormalSize, because need insert capthasymbols.
' If symbols inserted and website end loading then user should click IE MINIMIZE i.e. this trigered: go to next operation
Do While .ReadyState <> 4: DoEvents: Loop
End With
10
With objIE
If objIE.hwnd = SW_SHOWNORMAL Or objIE.hwnd = SW_MAXIMIZE Then
GoTo 10
Else
Call GETinfo
End If
End With
Set objIE Nothing
IE Quit
End Sub
[/VBA]
-
Thanks for Google & http://p2p.wrox.com/vb-how/27964-internet-explorer.html
[VBA]
Option Explicit
Dim IE As InternetExplorer
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type WINDOWPLACEMENT
Length As Long
flags As Long
showCmd As Long
ptMinPosition As POINTAPI
ptMaxPosition As POINTAPI
rcNormalPosition As RECT
End Type
Private Declare Function SetWindowPlacement Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long
Private Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long
Private Const SW_MAXIMIZE = 3
Private Const SW_SHOWNORMAL = 1
Private Const SW_SHOWMINIMIZED = 2
Private Sub CommandButton1_Click()
Dim ip As WINDOWPLACEMENT
ip.Length = Len(ip)
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Navigate "www.google.com"
Do Until IE.ReadyState = 4
Loop
GetWindowPlacement .hwnd, ip
ip.showCmd = 1 ' SW_SHOWNORMAL
SetWindowPlacement .hwnd, ip
10
Do Until IE.ReadyState = 4
Loop
GetWindowPlacement .hwnd, ip
If ip.showCmd = 3 Or ip.showCmd = 1 Then
GoTo 10
' Else
' Range("B1").Value = 1
End If
End With
' Call GETinfo
MsgBox "Done"
IE.Quit: Set IE = Nothing
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules