I am trying to use the API for aero peek. With a lot of digging and searching I stumbled upon this piece of code:
[DllImport("dwmapi.dll", EntryPoint = "#113", SetLastError = true)]
internal static extern uint DwmpActivateLivePreview(uint , uint , uint , uint );
But I can't get it to work.. I don't know what the parameters are.. I tried some API intercepting tools but that didn't work out. How can I discover how to properly call this API?
I eventually solved it my self. I have posted an article on my website about this: http://www.jesconsultancy.nl/tips-and-tricks/aero-apis.html. Unfortunately this is in dutch so here is a bit explaining:
[DllImport("dwmapi.dll", EntryPoint = "#113", SetLastError = true)]
internal static extern uint DwmpActivateLivePreview(uint switch, IntPtr hWnd, IntPtr c, uint d);
DwmpActivateLivePreview(1, Handle, topmostWindowHandle, 1);//activate
DwmpActivateLivePreview(0, Handle, topmostWindowHandle, 1);//deactivate
The first parameter is for activating/deactivating the Aero Peek functionality. The second parameter is the handle that Aero peek focuses to. The other two one I haven't been able to identify yet.
Edit: After some more messing around with this API I figured out the 3th parameter. When setting the TopMost property of a form, the form still shows sometimes underneath of the aero peek effect. If you pass the handle to that form that needs to be on top of the peek effect as the 3th parameter, and the TopMost property of your form is set to true, your form will be on top of the peek effect.
You can exclude a window from the Aero Peek effect. This is described here: http://huddledmasses.org/fun-with-pinvoke-and-aero-peek/