Does anyone have any information on why Windows 10 no longer allows you to set a custom WorkArea using SystemParametersInfo? I was using this to reserve screen space for dock/bar applications. Anyone had any luck getting it working?
For reference the code on this question works to set a custom work area In Windows 8.1, 8, 7, and XP, but no longer works on Windows 10. How can I resize the desktop work area using the SPI_SETWORKAREA flag?
My only alternative options seem to be using SHAppBarMessage (not preferable as it does not allow modifying form opacity to my knowledge), or using SetWindowsHookEx with WH_CALLWNDPROC, but that seems to require .dll injection for external processes?
I had a similar issue, an old program that correctly set the work area in Windows 7 stopped working in Windows 10.
What worked for me was changing the 'fWinIni' argument (the last argument) from SPIF_CHANGE to SPIF_UPDATEINIFILE.
So, what previously worked but doesn't anymore:
private const uint SPIF_SENDWININICHANGE = 2;
private const uint SPIF_UPDATEINIFILE = 1;
private const uint SPIF_CHANGE = SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE;
SystemParametersInfo(SPI_SETWORKAREA, 0, ref rect, SPIF_CHANGE);
What works correctly now:
private const uint SPIF_SENDWININICHANGE = 2;
private const uint SPIF_UPDATEINIFILE = 1;
private const uint SPIF_CHANGE = SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE;
SystemParametersInfo(SPI_SETWORKAREA, 0, ref rect, SPIF_UPDATEINIFILE);
Hopefully this works for you as well.