Sign in to follow this  
Followers 0
Geethu

Get handle of unnamed popup window

7 posts in this topic

Hi,

Now I want to get the Window Handle of a popup window. My problems are : 

1. It doesn't have a title and its class is same for the opened window other than popup window. So, when using the class name I got the handle of previous opened window.  

2. The popup window is opened after a short time by clicking a button. And the time is not always same for all the button click. So I can't access the active window after some sleep time. 

I have to read the text contained in the Popup window. Its control informations are : 

Class   :  WindowsForms10.STATIC.app.0.37504c8_r92_ad2

Instance  : 1

ClassnameNN  : WindowsForms10.STATIC.app.0.37504c8_r92_ad21

Name  : lblMessage

Advanced Mode  : [NAME:lblMessage]

ID  : 788142

Text  : successfully completed

 
Thanks in advance. 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Perhaps

While 1
    $hPopup = (WinWait("[Class:WindowsForms10.STATIC.app.0.37504c8_r92_ad21]", "successfully completed", 1) ? (WinActivate("[LAST]") ? WinWaitActive("[LAST]") : 0) : SetError(1, 0, 0))
    If Not @error Then ExitLoop
WEnd

See also here

Edited by Exit

My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thank you for your effort.

Its not working for me. The text successfully completed is contained in a label field and the label is contained in the popup window. When using the above code it returns 0. The popup window doesn't have a Class or any control information. Above given details are of the Label field. I have to read the content "successfully completed". What to do?:(

post-85609-0-80577700-1398248428.jpg

Edited by Geethu

Share this post


Link to post
Share on other sites

Here is the complete information when selecting label field.

>>>> Window <<<<
Title:
Class: WindowsForms10.Window.8.app.0.37504c8_r92_ad2
Position: 809, 481
Size: 302, 158
Style: 0x16800000
ExStyle: 0x00050109
Handle: 0x00030C20
 
>>>> Control <<<<
Class: WindowsForms10.STATIC.app.0.37504c8_r92_ad2
Instance: 1
ClassnameNN: WindowsForms10.STATIC.app.0.37504c8_r92_ad21
Name: lblMessage
Advanced (Class): [NAME:lblMessage]
ID: 134186
Text: successfully completed
Position: 8, 48
Size: 280, 64
ControlClick Coords: 141, 29
Style: 0x5600000D
ExStyle: 0x00000000
Handle: 0x00020C2A
 
>>>> Mouse <<<<
Position: 961, 561
Cursor ID: 0
Color: 0xF0F0F0
 
>>>> StatusBar <<<<
 
>>>> ToolsBar <<<<
 
>>>> Visible Text <<<<
OK
successfully completed
 
 
>>>> Hidden Text <<<<

Share this post


Link to post
Share on other sites

Exit, you can't use class...that changes each time...you'd have to use RegExpClass, or the NAME.

I also like using

_WinAPI_GetWindow

Option 6...you pass in the parent handle, and it will send back the handle of the enabled popup...may or may not work with that specific class of window, but a good one to check.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0