It's no bug, neither in Windows nor in Delphi. It's Delphi /
VCL specific. If you create an application with Delphi-
VCL you can't address your mainform directly. A message you send to the mainform will always be managed by the TApplication-Part.
You can test this behaviour if you create two seperate applications, hide the mainform in app 1 and your Task-Button disappears. Then send a SW_RESTORE or SW_SHOW message from app 2 to app 1 and you can see that your Task-Button will be shown again, but not your MainForm. To set it visible, you have to
handle this message-event byself and show your mainform from inner your app 1 (Form1.show).
If you hide your mainform, it seems your application normalizes all the StayOnTops, too and your StayOnTop is not at the expected position (in front of all), so you have to restore it by calling Application.RestoreTopMosts.
I hope my english was well enough to explain the matters.
Greetings,