views:

192

answers:

2

Is there an api to bring the vista side bar to the front (Win+Space) programatically and to do the reverse (send it to the back ground).

+1  A: 

Probably using SetWindowPos you can change it to be placed the top / bottom of the z-order or even as the top-most window. You would need to find the handle to the sidebar using FindWindow or an application like WinSpy.

But after that something like.

Sets the window on top, but not top most.

SetWindowPos(sidebarHandle, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NORESIZE);

Sets the window at the bottom.

SetWindowPos(sidebarHandle, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NORESIZE);

This is my best guess on achieving what you asked, hopefully it helps.

Cory
I tried something like this quickly last night but it didn't seem to work. That's what got me thinking there might be an API.
Mike
A: 

You probably shouldn't do it at all, since such action may annoy the user when executed at the wrong time (95% of cases*), just like stealing focus with a "Yes/No" prompt.

Unless your product's task is to toggle the sidebar of course. ;)

There's no official API for that anyway.

*Purely hypothetical figure

macbirdie
I appreciate your "concern" but I really have a legitimate use for this. Honest... :)
Mike
So what *is* the use for this? ;)You're installing a gadget and want the sidebar with it inserted to appear? Just curious.
macbirdie
I'm writing a utility activate and deactivate the sidebar in a manner similar to what the Mac does.
Mike