Enrique Gómez
Enrique Gómez

Reputation: 1

How can I close a second window (WIN32), and re-open it

Im using DestroyWindow(HWND), but when I need to open again the same window, doesnt execute. I already try with CloseWindow(HWND), but just minimizes de window. This is what i have in the command Destroy

case WM_DESTROY: {
        DestroyWindow(contacts);
        break;
    }

Upvotes: 0

Views: 408

Answers (1)

Michael Chourdakis
Michael Chourdakis

Reputation: 11148

First, your code is invalid. WM_DESTROY is sent to the window after you (or someone else) have already called DestroyWindow().

You want to call this function in response to WM_CLOSE instead. This destroys the window permanently.

Second, there is no reopening. Either hide/show (ShowWindow) or recreate. Most probably all you need is ShowWindow with SW_HIDE/SW_SHOWNORMAL.

Upvotes: 2

Related Questions