How do I count the number of open window using VB?
I've written a program, and part of it needs to cycle through every open window on my PC (doing a Alt+tab sendkey) only once. Anyhow, I need to know how I can get a count of the number of open windows on my PC, so I can use that as a comparison value in a FOR statement. Is there a function that returns this value? Thanks,
Joe
....
Private Sub Command1_Click()
dim windowCount as integer
dim i as integer
windowCount = <function that returns number of open windows>
For i = 0 To windowCount
... do stuff...
Next
End Sub
....
I'm using Visual Basic - Microsoft Visual Studio 6.0
Re: Counting the number of open window using VB.
It's much easier to use:
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long