winapi - How to capture WM_SHOWWINDOW command in MFC -
Whenever a dialog box is displayed, I am trying to take some action. Like this we have a gentle dialogue, and we are hiding / showing the dialogue on some button clicks. But when we are shown a dialogue, we need to take some action. I have included the WM_SHOWWINDOW message, but the control is not coming inside the OnShowWindow (BOOL bShow, uint nStatus) function.
We are using the ShowWindow (SW_HIDE) and ShowWindow (SW_SHOW) function to hide / show dialog boxes, please suggest suggestions on how to get some pointer.
Thank you in advance
Mukesh
Along with Notepad and Spy ++ it has been tested with:
#include & lt; Windows.h & gt; Int Callback Winman (Hunsstas Instance, Huntsstäus Pre Preinstance, Lpstrap LPCMDline, Int NCMD Show) {HWNH HWND = SearchWindows (Zero, L "Untitled - Notepad"); ShowWindow (hwnd, SW_HIDE); Sleep (4000); ShowWindow (hwnd, SW_SHOW); Return ERROR_SUCCESS; } For window hiding, you should be getting WM_SHOWWINDOW, WM_WINDOWPOSCHANGING, then finally WM_WINDOWPOSCHANGED. For the window showing, the target was not received, WM_SHOWWINDOW
but still got WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED.
You can check the flag in WINDOWPOS for SWM_WINDOWPOSCHANGED and for SWP_HIDEWINDOW / SWP_SHOWWINDOW.
Comments
Post a Comment