I solved it by unchecking the box which you can see in the following screenshot.
Go to Control Panel > Ease of Access Center > Make the Keyboard Easier to Use
Then search for the setting "Make it easier to manage windows" and un-check the option "Prevent windows from being automatically arranged when moved to the edge of the screen"
After unchecking this option, it works again.