CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2007
    Posts
    1

    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
    Last edited by jcacka; February 9th, 2007 at 12:08 PM.

  2. #2
    Join Date
    Mar 2005
    Posts
    226

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured