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 have bad news for everyone actually using this undocumented function. Windows 10 appears to have added an extra argument to the end. This likely means your code that run fine under Win7 will probably crash under Win10 because the stack pointer is going to screwed up after you call this function. Plus, there is a chance that calling this function with a missing stack argument will cause Win10 to deref a bad pointer during the call itself.
I used the following definition.
I simply passed zero in this new argument. Running 64bit code under Win10 64bit, I was able to activate Aero Peek using arguments as described in the other answers on this page. Running 32bit code under Win10 64bit, I got the same 0x80070018 error I received when running 32bit code under Win7 64bit.
can you elaborate on what you are trying to do? are you trying to invoke peek or support custom Aero peek in your own application?
if the latter you should reference http://msdn.microsoft.com/en-us/library/ff819048(v=VS.85).aspx and related documentation.
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:
The first parameter is for activating/deactivating the Aero Peek functionality. The second parameter is the handle that Aero peek focuses to. The other
twoone 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/
I know this is an older question but, the accepted answer lacks completeness.
Below is the proper usage of the Aero Peek API.
I spent several months reverse engineering most of the cool Windows 7 taskbar API and this is part of my findings. Take it or leave it, this is the proper way to use the Aero Peek API. My "research" was done in 2008, while Windows 7 was still in beta and leaked preview builds were prevalent. For those that might give a shit, this code should work in Windows 8, too. A simple example follows, below:
This code is processor agnostic, compile it however you want and it will still work. Win32 and x64 are both welcome.