We have an application that is run in multi-monitor environments. Users normally have the application dialog spread out to span multiple mointors.
If the user locks the workstation, and then unlocks it, our application is told to resize.
Our users find this behavior frustrating, as they then spend some time restoring the previous layout.
We're not yet sure whether it is the graphics driver requesting the resize or Windows. Hopefully through this question, it will become clearer which component is responsible,
Popular applications like (File) Explorer and Firefox behave the same way in this setup. To replicate just:
Win+E
)
Win+L
),How do I prevent Window resizing when the Workstation is Locked then Unlocked?
Will we need to code in checks for (un)locking?
Is there another mechanism we're not aware of?
Before the window is resized, the application will get a WM_WINDOWPOSCHANGING message from Windows. You can intercept that message and change the parameters, forcing the window to stay put. You need to be careful, because you'll get the same message when the user is trying to move or resize the window. Probably when it's maximized or minimized, too.
Edit: You can use the WTSRegisterSessionNotification function to get additional messages. The messages are intended for fast user switching, but the lock screen is implemented in Windows as a system session.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With