PDA

Click to See Complete Forum and Search --> : Help, windows opened


Dec 26th, 2000, 10:29 PM
Help,

Could you please give me some peice of code that
will tell me all the windows opened at a certain
time

Thanks in advance,

amitabh
Dec 27th, 2000, 02:05 AM
Have you tried "EnumWindows". It is used to enumerate all top level windows. I have never used it so I don't have the code, but I think it would be pretty easy.

Dec 27th, 2000, 06:22 AM
could you tell me the enumwindows code

amitabh
Dec 27th, 2000, 07:45 AM
Put this code in a form

Public Function ListWindows() As Long

Dim rc As Long
Dim lParam As Long

'We're not concerned with a custom message at this time
lParam = 0

'call the api
ListWindows = EnumWindows(AddressOf EnumWindowsProc, lParam)

End Function

Private Sub Command1_Click()
Call ListWindows
End Sub


Put this code in a standard basic module(not in form or in class module)

Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long

Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean

Debug.Print hwnd

'while this value is true it will keep on searching for open windows till it reaches
'the last window
EnumWindowsProc = True

End Function


But this will return you a large number of handle's. If you need only those on the desktop, try "EnumDesktopWindows" instead.

Jop
Dec 27th, 2000, 08:30 AM
Download my window class: http://www.geocities.com/despotez/WH/

it has an example to get all the open windows too.