<p>I've got a code that lists the running application on a win32 box, and then displays theirs icons.</p>

<p>So far so good, I get the hwnd of the app, then call for GetClassLong(hwnd,GCL_HICONSM),  and everything's fine.</p>

<p>But the case of a java apps is a pain to deal with, as the process answering to my calls is javaw.exe, and not the shiny-pimpy java application, who's got a so beautiful icon...</p>

<p>I gave a shot at GetWindowThreadProcessId also, but alas, it's the PID of javaw that's returned...</p>

<p>There's a way to do this though, as the task manager (alt+tab) displays the good icon.</p>

Mmm, it can be done, because
Process Viewer
has a Show Applications button which does that (even if the main view shows the Java's icon). Alas this freeware isn't open source, so it won't tell its secret... :-(
Sysinternals' ProcMon doesn't do that, alas.
I will dig a bit more... :-)
[EDIT] Both a MS KB article and a
Code Project
article recommend using WM_QUERYDRAGICON if GCL_HICON fails...