In my apps I use sometimes: ShowWindow(MyForm.Handle, SW_SHOW)
.
The documentation for ShowWindow function has a section for SW_SHOWNORMAL
that says
"An application should specify this flag when displaying the window for the first time".
Does it means that for every form (that I pass to ShowWindow
) I need to keep a boolean var to see if the form was displayed or not and based on that I should use SW_SHOW
or SW_SHOWNORMAL
?
What is the deep meaning of SW_SHOWNORMAL
?
The term normal is synonymous with restored. This terminology dates back to older versions of windows and nowadays all the MSDN documentation uses restored rather than normal or normalized.
So, SW_SHOWNORMAL
sets the window state to restored and makes the window visible. On the other hand, SW_SHOW
simply makes the window visible.
Back in the day, restored was called normalized, minimized was called iconic, and maximized was called full screen. If memory serves, that older terminology was still in use in Windows 3.1, but was changed with Windows 95 and NT.
SW_SHOW
is often used in conjunction with SW_HIDE
so if you were showing/hiding a window for some reason (e.g. based on a user action) you would use them in tandem. SW_SHOWNORMAL
was originally used in the 'old' days when first showing a window.
SW_SHOWNORMAL
is sometimes valuable if you want to make sure a window is not minimized (or maximized) at some particular point in the program (e.g. if the window might be minimized but you want to 'restore' it so the user can interact with it).
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