Switching Focus between Windows
Posted by admin - Apr 1, 2008 Articles, Dani Vainstein, QTips, Windows 0 0 Views : 273 Receive Updates For This Category
Article Tools
- Print this page
- Add Comment
- Send to Friend
- Last Updated on :
Jul 16, 2011
The SwitchToThisWindow function is called to switch focus to a specified window and bring it to the foreground.
API Syntax : VOID SwitchToThisWindow( HWND hWnd, BOOL fAltTab );
Parameters :
hwnd – Handle to the window being switched to.
fAltTab – A TRUE for this parameter indicates that the window is being switched to using the Alt/Ctl+Tab key sequence. This parameter should be FALSE otherwise.
Extern.Declare micInteger, "SwitchToThisWindow", "user32.dll", "SwitchToThisWindow", micHWnd, micInteger
SystemUtil.Run "iexplore.exe", "www.advancedqtp.com", "", "open"
SystemUtil.Run "firefox.exe", "www.advancedqtp.com", "C:\Program Files\Mozilla Firefox", "open"
Set ie = Description.Create()
ie( "micclass" ).Value = "Browser"
ie( "title" ).Value = "AdvancedQTP Home.*"
ie( "version" ).Value = "internet explorer 6"
Set fx = Description.Create()
fx( "micclass" ).Value = "Browser"
fx( "title" ).Value = "AdvancedQTP Home.*"
fx( "version" ).Value = "firefox 1.1"
hwndIE = Browser( ie ).GetROProperty( "hwnd" )
hwndFX = Browser( fx ).GetROProperty( "hwnd" )
Extern.Declare micInteger, "SwitchToThisWindow", "user32.dll", "SwitchToThisWindow", micHWnd, micInteger
retVal = Extern.SwitchToThisWindow( hwndIE, True )
Wait 1
retVal = Extern.SwitchToThisWindow( hwndFX, True )


