Results 1 to 3 of 3

Thread: Explain hwnd VBScript Code

  1. #1
    Junior Member
    Join Date
    Apr 2008
    Answers
    3

    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?


  2. #2
    Contributing Member
    Join Date
    Feb 2008
    Answers
    36

    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.


  3. #3
    Junior Member
    Join Date
    Sep 2007
    Answers
    2

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact