Game Development Community

How to set a dialog invisible in VC++?

by Ivan Yung · in Technical Issues · 04/27/2002 (12:15 pm) · 1 replies

Hi, I'm a beginner of Win32 programming, I don't how to make a dialog invisible in VC++. I have tired to not to click "visible" in the properties of the dialog, but it can't work. I don't know why. Could anybody please help me solve the problem? thanks.

#1
04/27/2002 (12:42 pm)
Well, you'll need to know the handle to the window. Once you know that just use:

ShowWindow(hwnd, SW_HIDE);

hwnd is the handle to the window, and SW_HIDE is a macro telling ShowWindow what to do, in this case hiding the dialog.

The other macros you can send to ShowWindow include SW_MINIMIZE, SW_MAXIMIZE, and SW_RESTORE.

You'll then need to invalidate the window rectangle area with this call:

InvalidateRect(hwnd, NULL, 1);

This essentially tells windows that particular coordinates of the window need to be redrawn since they no longer exist and we need to update the screen.