I asked this on "microsoft.public.win32.programmer.ui" and got directed
here, hopefully you can help.
I need to to some processing whenever a window in my application is made
visible. I'd hoped to do this with the WM_SHOWWINDOW handler. Rather
annoyingly this message is not sent if ShowWindow() is called with
SW_SHOWNORMAL (anyone know why?). I can't really track down all the call
sites that make this window visible and I don't really want to cover
ShowWindow(). I don't think the message is sent if SetWindowPos is used to
show the window either.
What's a good way of running code when a window is made visible, regardless
of the mechanism?
Thanks,
john.
> I need to to some processing whenever a window in my application is made
> visible.
What do you mean by "visible" ?
shown/hidden, partially visible, completely visible(topmost), .. ?
> I need to to some processing whenever a window in my application is made
> visible. I'd hoped to do this with the WM_SHOWWINDOW handler. Rather
> annoyingly this message is not sent if ShowWindow() is called with
> SW_SHOWNORMAL (anyone know why?).
It's called only is the visible state of the window changes
Otherwise, WM_SIZE is sent (before WM_WINDOWPOSCHANGING, activating,... etc)
A window is either "hidden" (ShowWindow(hWnd,zero)), or "not hidden"
(ShowWindow(hWnd,non zero)).
I need to catch the case when a window becomes non-hidden for whatever
reason. So partialy exposed doesn't count, restored / maximized don't
count. Z-order changes don't count. I suppose it could also be described as
when the state of the WS_VISIBLE bit changes (Hmm, wonder if WM_STYLECHANGED
would help?).
I guess SW_SHOWNORMAL is special because it could be used to restore a
minimized or maxmized window, without changing the WS_VISIBLE bit, however
it is also frequently used to make a non-visible window visible.
Thanks,
/John.
(What I actually want to do is send the WM_UPDATEUISTATE message to the
window to get mnemonics on controls correct. My understanding of this
message is that is only automatically sent by the system in dialog boxes,
not on "regular" windows. So, I want to catch the initial "show" of the
window and send this message then)
"JohnD" <jo...@dyalog.com> wrote in message news:ggh622$gg0$1...@aioe.org...
Then WM_SHOWWINDOW is always sent when the window becomes visible.
With
ShowWindow(hWnd, SW_HIDE);
folowed by
ShowWindow(hWnd, SW_SHOWNORMAL);
I get WM_SHOWWINDOW
Oh, ok, I'll check that. That's not what the documentation says, but I admit
I didn't check.
Thanks.
"antoine" <ant...@nospam.com> wrote in message
news:ggjbeg$3bh$1...@aioe.org...