Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Explain hwnd VBScript Code

This is a discussion on Explain hwnd VBScript Code within the QTP forums, part of the Software Testing category; Please explain the following vbscript code. Answer soon. "Browser("index:=0").GetROProperty("hwnd")" Hi, I'm working in QTP9.0. Please explain "hwnd" and its use in QTP script?...

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 05-17-2008
Junior Member
 
Join Date: Apr 2008
Location: Kolkata
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Sunita2k is on a distinguished road
Explain hwnd VBScript Code

Please explain the following vbscript code. Answer soon.

"Browser("index:=0").GetROProperty("hwnd")"
Hi, I'm working in QTP9.0. Please explain "hwnd" and its use in QTP script?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-19-2008
Contributing Member
 
Join Date: Feb 2008
Location: Pune
Posts: 37
Thanks: 2
Thanked 8 Times in 7 Posts
Tina Mahajan is on a distinguished road
Re: Explain hwnd VBScript Code

Hi Sunita,

'hwnd' is a property of an object, just like name/title.

"Browser("index:=0").GetROProperty("hwnd")"

This line of code will retrive the value of "hwnd" property for the Browser with index 0. (i.e. the first browser that was opened.)
Using this property you can then perform actions on that particular browser.

try to execute this code...
Open a notepad file before executing the code.

' Get the hwnd value for the notepad into a variable.
val_hwnd = Window("Notepad").GetROProperty("hwnd")
msgbox val_hwnd

' Perform action on the notepad whose hwnd value matches with the captured one.
SystemUtil.CloseProcessByHwnd (val_hwnd)

Hope this helps you understand.
Let me know if you still have any doubts.

Regards,
Tina Mahajan.
Reply With Quote
  #3 (permalink)  
Old 12-31-2008
Junior Member
 
Join Date: Sep 2007
Location: Baroda
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Chetan Parmar is on a distinguished road
Smile Re: Explain hwnd VBScript Code

hi,

Thanks for giving me such a nice code,

I am using the following code for Minimize window:
hwnd1=Browser("Prod-CST1").GetROProperty("hwnd")
hwnd2=Browser("Prod-CST1").Object.HWND
Set cWindow=Window("hwnd:="&hwnd2)
cWindow.Minimize

and this code is for Restoring window
hwnd3=Browser("Advertiser: Ongoing").GetROProperty("hwnd")
hwnd4=Browser("Advertiser: Ongoing").Object.HWND
Set cWindow=Window("hwnd:="&hwnd4)
cWindow.Restore

I am using QTP 9.2 and IE 7.0 for record and run scripts
The above both code is working fine in Windows XP but This code is not working in Windows Vista,

Could anyone please help me for Vista.

Thanks,
Chetan
Reply With Quote
Reply

  Geeks Talk > Software Testing > QTP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
VBscript tutorial 4 QTP QuickTestMichael QTP 1 07-24-2008 05:40 PM
Please explain this code jainbrijesh QTP 3 02-25-2008 11:54 AM
VBScript call function *.dll .net jporras QTP 2 02-22-2008 02:40 AM
Run the Vbscript File pradeep_m QTP 1 01-15-2008 02:12 AM
How to run the Bath file using QTP/Vbscript pradeep.madishetti QTP 1 01-09-2008 10:09 AM


All times are GMT -4. The time now is 03:27 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved