views:

72

answers:

3

Basically what I am trying to do is write my own pseudo task bar in C++. The program needs to idle until another program is started up, at which point it needs to visually depict that the other program is running. For each other program that is running, the user should be able to click on the visual representation and have Windows switch focus to the selected program.

The big underlying question at this point: is this even a possibility? Or has Windows hidden most/all of its fiddly-bits to make this close to, if not completely, impossible?

[EDIT:] restructured the question

+2  A: 

The obvious starting point would be SetWindowsHookEx(WH_SHELL,...); which will get you notifications when top-level windows are created or destroyed (along with some other related events, like a different window being activated, a window's title changing, etc.)

Jerry Coffin
I am not very familiar with using hooks, but from what I can tell, the hook needs to be set in global thread space, which means the actual ShellProc needs to reside in a separate .dll to be accessed from the actual taskbar program, does this sound like an accurate breakdown?
Hab
A: 

It seems possible to me at least in a basic way: 1. Set up a shell hook as described by Jerry 2. figure the executable file from the module handle to access it's icons using shell services

The Vista-like feature of keeping a 'live' miniature of the screen seems much more challenging.

Elemental
+1  A: 

Think ahead to actually bringing the window to the front, as I once researched myself.
SetForegroundWindow() won't work unless issued from the foreground process - neither SwitchToThisWindow() nor the AttachThreadInput() kludge seemed to always work, but maybe I just wasn't doing it right.
Anyway as far as I know there no way to make a window foreground as good as Windows does, please enlighten me if say you discover say an undocumented call which actually Works.

pngaz