Troubles with SendMessage(WM_GETICON)

  • Thread starter Thread starter D'ALMEIDA Jorge
  • Start date Start date
D

D'ALMEIDA Jorge

Well i'm trying to get the icon of the visibles windows.
i'm using:
EnumWindows, IsWindowVisible, and SendMessage with the "WM_GETICON"
parameter

sometimes then SendMessage function return "IntPtr.Zero", but it souldn't
cause the windows is visible...


here is my main code:

Dim WndIcon_s As System.IntPtr = SendMessage(WindowsHanlde,
WM_GETICON, ICON_SMALL, 0)
Dim WndIcon_l As System.IntPtr = SendMessage(WindowsHanlde,
WM_GETICON, ICON_BIG, 0)

If Not WndIcon_s.Equals(IntPtr.Zero) Then

APP_Icons_s.Images.Add(System.Drawing.Icon.FromHandle(WndIcon_s))

APP_Icons_l.Images.Add(System.Drawing.Icon.FromHandle(WndIcon_l))
End If

PS: i've already tryed with long instead of IntPtr, the probleme persist


Of curse i can get the icon of the exe assiosiated to the handle, but it's
not always the right icon!

for exemple I have troubles getting the VisualStudio icon, the trillian
icon, the winamp icon, but it work fine withe the iexplorer, or the explorer
windows...
any help will be appreciated, and excuse my english.
 
Back
Top