I want to refresh the aero preview that’s displayed when hovering over a taskbar icon on Windows (or when Alt+Tabbing).
I found a function called
DwmInvalidateIconicBitmaps that seems promising, but when I use it:
[DllImport("dwmapi.dll")] static extern int DwmInvalidateIconicBitmaps(IntPtr hwnd); ... int res = DwmInvalidateIconicBitmaps(MyWindowHandle);
res gets set to
-2,147,024,809. When I look at the hex it comes out to
FFFF FFFF 8007 0057, which seems to correspond to
E_INVALIDARG according to this site.
My window handle however is valid and is used in other places successfully. Another site I came across mentioned that this error can be thrown when the DLL couldn’t be loaded. Could that be the issue?
I also doesn’t see this function mentioned on the pinvoke site though I do see other DWM functions, which is odd.
Windows 10 / .NET Core
Source: Windows Questions