There are two methods for detecting visibility of a particular control: cGetWindow.IsStyle() and Smart.StateText
Here is a bare bones example of cGetWindow.IsStyle
Dim cgw As New CGetWindow
Dim lw As New CListWindows
Sub ClickButton(sText As String)
For Each h In lw.InProcess(hWnd)
If View(h) Like "sText" Then
If cgw.IsStyle(styVISIBLE, h) Then
Click h, False, False
Exit Sub
End If
End If
Next h
End Sub
Important note: the visibility of something may be controlled by a parent
control, or the parent's parent, or parent's parent's parent. Here you'd need
to explore your application to see if it's doing such a thing:
If cgw.IsStyle(styVISIBLE,getParent( h))
Smart can also be useful to detect visibility
Adding the below to the loop as above, you could see what the StateText is.
Smart.Create h, 2, 2
Debug.Print Smart.StateText
Similar to cGetWindow.IsStyle how this returns is based on the behavior of your
application.
Thom C. Blackwell, VP Technical Services
Boston Software Systems, Inc.
Phone: 866.653.5105 x807
Mobile: 508.423.8463
Fax: 508.319.3015
www.bostonsoftwaresystems.com<http://www.bostonsoftwaresystems.com/>
Healthcare Automation - Revolutionizing How You Work.
The information contained in this message may be confidential and legally
protected under applicable law. The message is intended solely for the
addressee(s). If you are not the intended recipient, you are hereby notified
that any use, forwarding, dissemination, or reproduction of this message is
strictly prohibited and may be unlawful. If you are not the intended recipient,
please contact the sender by return e-mail and destroy all copies of the
original message.
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, July 30, 2013 9:18 AM
To: Talk
Subject: RE:[talkbws] InProcess Loop Click
I haven't tested this, but in other programs I've done, this seems to be the
logic:
ClickFunction ("OK")
Function ClickFunction(strClick)
Dim L As New CListWindows
For Each h In L.InProcess(R.hWnd)
If h.visible = true then
If View(h) = strClick Then
Click (h)
End if
End If
Next h
End Function
From: [email protected]<mailto:[email protected]> [mailto:[email protected]]
Sent: Tuesday, July 30, 2013 9:13 AM
To: [email protected]<mailto:[email protected]>
Subject: [talkbws] InProcess Loop Click
Below is what I use to click a button in a windows application. It cycles
through all of the buttons in the app instead of just the current visible ones.
Does anyone know if there is a way to get it to only look to the visible
buttons?
ClickFunction ("OK")
Function ClickFunction(strClick)
Dim L As New CListWindows
For Each h In L.InProcess(R.hWnd)
If View(h) = strClick Then
Click (h)
End If
Next h
End Function
Thanks,
Drew Glaser
Data Programmer Analyst
CareTech Solutions /
Blanchard Valley Health System
Office: (419) 429-7614
[cid:[email protected]]<http://www.caretech.com/>
Helping extraordinary people do extraordinary things
Best in KLAS
Extensive IT Outsourcing
2008, 2009 & 2010
Top 20 Best in KLAS Awards
www.KLASresearch.com<http://www.klasresearch.com/>
[cid:[email protected]]
--- To post a message to this list, send mail to:
[email protected]<mailto:[email protected]> You are currently subscribed as:
[email protected]<mailto:[email protected]> Unsubscribe in the
customer center on our website:
http://www.bostonsoftwaresystems.com/Customers/ListServe.aspx
--- To post a message to this list, send mail to:
[email protected]<mailto:[email protected]> You are currently subscribed as:
[email protected]<mailto:[email protected]> Unsubscribe in
the customer center on our website:
http://www.bostonsoftwaresystems.com/Customers/ListServe.aspx
--- To post a message to this list, send mail to: [email protected] You are
currently subscribed as: [email protected] Unsubscribe in the
customer center on our website:
http://www.bostonsoftwaresystems.com/Customers/ListServe.aspx<<inline: image001.gif>>
<<inline: image002.gif>>
