
Getting list of ICONS of current tasks
Quote:
> I know this isnt really the right place to ask, but my isp is being a bit
> trippy and I cant get a list of any other groups. So here goes.
> What I want to do is display a list of icons of the currently open tasks.
At
> the moment I am using GetWindow etc. and a timer (and drawiconex to draw
the
> icons at 64x64) to get everything, but the icons re-arrange themselves
which is
> anoying.
> So I need an example of using Enum Windows or whatever it is and maybe
also of
> using a hook or something to refresh automatically ? right idea?
> Any help would be much appreciated
To enumerate all the child windows, use something like this:
'*** START CUT *** On a form:
Private Sub Form_Load()
'Change "Form1.hwnd" to whatever window
' handle you want to down on
EnumChildWindows Form1.hwnd, _
AddressOf EnumChildProc, ByVal 0&
If NumWnd = 0 Then
Msgbox "No child windows detected on specified hWnd",. _
vbExclamation, App.Title
Else
MsgBox NumWnd & " child window" & _
IIf(NumWnd = 1, "", "s") & _
" detected on specified hWnd", _
vbInformation, App.Title
End If
End Sub
'*** END CUT ***
'*** START CUT *** In a module:
Public Declare Function EnumChildWindows Lib _
"user32" (ByVal hWndParent As Long, _
ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Long
Public WndList() As Long
Public NumWnd As Integer
'Enum child windows callback function
Public Function EnumChildProc(ByVal hwnd As Long, _
ByVal lParam As Long) As Long
'Store this hWnd in the list
ReDim Preserve WndList(NumWnd) As Long
WndList(NumWnd) = hwnd
NumWnd = NumWnd + 1
'Return 1 to continue enumeration
EnumChildProc = 1
End Function
'*** END CUT ***
It will store the list of hWnd's in the WndList() array.
Hope this helps,
Mike
-- EDais --
WWW: Http://www20.Brinkster.com/EDais/