Using WM_SHOWWINDOW to Show a Window instead of ShowWindow()

Synetech picture Synetech · Sep 2, 2010 · Viewed 9.7k times · Source

I’m trying to use the SendMessage function of a hotkey utility (or NirCMD, etc.) to get a hidden window to pop up. I can for example get windows to close by sending 0x0010 (WM_CLOSE), but when I try sending 0x0018 (WM_SHOWWINDOW) with a wParam of 1 and an lParam of 0, nothing happens.

I’ve looked around, and the few places where someone complained that WM_SHOWWINDOW did not work, they happily took the suggestion to use ShowWindow() instead.

However I don’t have ShowWindow() available; I can only send Windows messages. But ShowWindow() is not magic, surely it works by SendMessage-ing a WM_SHOWWINDOW or something under the covers.

How can I get a window to display itself by sending it a message?

Thanks.

Answer

Anders picture Anders · Sep 3, 2010

Try these two messages:

SendMessage(h,WM_SYSCOMMAND,SC_MINIMIZE,0);
SendMessage(h,WM_SYSCOMMAND,SC_RESTORE,0);

Or if using 3rd party apps is ok, try cmdow