Hi, im trying to work out how to get an applications taskbar icon. So far ive gotten it to work, but it only seems to work with .net applications. This is my code:
The problem is, with non .net applications SendMessage always returns 0. Ive tried with different things like ICON_BIG and ICON_SMALL2, but it always returns 0. Ive checked with spy++ and the window is definatly getting the WM_GETICON request but it just returns 0.
Can anybody help??
Thanks, Dan
Code:
Dim Handle As Integer = TheHandleToAnApp
Dim hicon As Integer = SendMessage(Handle, WM_GETICON, ICON_SMALL, 0)
MsgBox(hicon) the handle to the icon
Dim ptr As New IntPtr(hicon)
Dim i As Icon = Icon.FromHandle(ptr)
The problem is, with non .net applications SendMessage always returns 0. Ive tried with different things like ICON_BIG and ICON_SMALL2, but it always returns 0. Ive checked with spy++ and the window is definatly getting the WM_GETICON request but it just returns 0.
Can anybody help??
Thanks, Dan