An interesting glitch restores timedate.cpl window when it's minimized

usasma

Retired Admin
Joined
Feb 20, 2012
Posts
2,126
A friend pointed this out to me yesterday.
It seems to work in all versions of Windows (we tested it on Vista, 7, 8, 8.1, and 10)

Open up several programs.
Open up timedate.cpl (you can do this by right clicking on the clock in the lower right corner and select "Adjust date/time"
Minimize all windows (I click on the thing to the right of the clock to minimize everything.
Click on one of the active icons in the task bar (to restore that program's window).
The timedate.cpl window will also be restored. AFAIK, it doesn't happen with any other window(s).

Can't figure out why this would be by design.
Any thoughts on why it's happening?
 
I'll have to get back to you on this (on phone so can't check), but I'm 99% sure this is completely by design and won't occur with just timedate.cpl but all modal dialogs. It's also because you are using the minimise all button - the same won't happen if you minimise everything individually.
 
Thanks Richard! I'm uncertain what modal Windows are, but we've tried it with other things in the taskbar and didn't get similar results.
Did not try with other .cpl windows tho' - may try that at work today.
Haven't tried with minimizing individually, but again - may be able to try it at work today.
 
Thanks Richard! I'm uncertain what modal Windows are, but we've tried it with other things in the taskbar and didn't get similar results.
Did not try with other .cpl windows tho' - may try that at work today.
Haven't tried with minimizing individually, but again - may be able to try it at work today.

Here's a little test case for you:

Close all of your current windows (actually, this is technically not necessary but may make things easier to see if you can) and do the following:

Open a new notepad window. Type a few random characters, then open a second notepad window.
Use the minimise all button to bottom right hand corner of screen, then use the taskbar to reopen the second notepad window. You should see just the second notepad window reappear.

Now close both windows and try again - open a first notepad window, type a few random characters, then click the red x to close it. Leave the Save/Don't Save/Cancel prompt on screen.
Now open a second notepad window, then use the minimise all button to minimise all windows. Then use the taskbar to reopen the second window, and you should find that both reappear.


This is because the first window now has a modal dialog in front of it. The Save/Don't Save/Cancel window forces interaction with it before you can return to the main window. In other words, if you try to click on File in the first window with the Save/Don't Save dialog still open, it'll just flash at you. That's a modal dialog.


One of the advantages with this setup is that if you ever lose a modal dialog somewhere underneath a million and one other windows, and the window you're currently trying to interact with just keeps on flashing, you can get out of this situation by minimising all, then opening and re-minimising any random window from your taskbar. This will now leave on your screen only modal dialog windows - and you can then clear the message and return to work.

Now, I have yet to fully figure out why timedate.cpl is acting as though modal. It's running under process rundll32.exe and in essence it's progmatically modal only. As far as I can see there is no physical graphical window (not even the task bar/explorer.exe/dwm.exe/anything) which physically flashes. However, as a programmer I know that the formal definition of a parent window has absolutely nothing to do with what's displayed on screen. It's very possible to create windows which aren't ever displayed. So - and I have yet to figure out the precise details of how - rundll32.exe seems to be invoking timedate.cpl in such a way that it is a modal dialog of a non-physical parent window.


As an aside, I once saw a really, really excellent description of why it is that modal windows are designed like this. Someone on Stack Overflow had a fantastic explanation for why it is we can't be allowed to interact with a main window underneath a modal one. Something about the message queue getting out of horribly out of sync unless a certain vital optimisation was taken out. Hence the parent window can't allow interaction, no matter how backwards that may seem. Or something like that. I'll see if I can find it sometime.

On similar lines, Windows Internals explains why modal dialog window functions often become inactive after initiating and then cancelling a shutdown operation.

Richard
 
Haven't had a chance to check this out yet, but I do have a question.

If I understand correctly, the modal window can be invisible?

I'll have a look in Windows Internals to see about modal dialogs - I haven't re-read it recently.

Thanks for taking the time to explain this.
 
Haven't had a chance to check this out yet, but I do have a question.

If I understand correctly, the modal window can be invisible?

I'll have a look in Windows Internals to see about modal dialogs - I haven't re-read it recently.

Thanks for taking the time to explain this.

I'm sort of doing this off the top of my head - haven't had a chance to check yet either, but I don't think the modal window can be, but I think that a modal window's parent can be.
 

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top