Thursday, April 29, 2010

Maximize the Browser without error even though it already maximized

With below code we can maximize IE. if Browser already maximized it does not give any error and smothly execute the code.

Code :-

BrHwnd= Browser("Understanding of Automation").GetROProperty("hwnd")

Const GA_ROOT = 2

'Declare Function GetAncestor Lib "user32.dll" (ByVal hwnd As Long, ByVal gaFlags As Long) As Long

Extern.Declare micLong, "GetMainWindow", "user32" ,"GetAncestor",micLong, micLong

'Maximize the Browser

wHwnd = Extern.GetMainWindow(BrHwnd, GA_ROOT)Window("hwnd:=" & wHwnd).Maximize

No comments:

Post a Comment