Nohsib
Nohsib

Reputation: 3712

How to maximize a window after minimizing it

How does one maximize a window after minimizing it? I use nCmdShow = 3 to maximize it and nCmdShow = 6 to minimise it using ShowWindow(hwnd, nCmdShow). However, once I minimize the window, I cannot restore or maximize it.

This is because I cannot store the handler for the window that is minimized so that the same window can be maximized on certain condition? How do I achieve the same thing?

Upvotes: 5

Views: 5019

Answers (3)

MRIDULA
MRIDULA

Reputation: 1

You can minimise the window by Alt+Enter and maximise the window by the same keycombination.

Upvotes: -5

noelicus
noelicus

Reputation: 15055

You need to call ShowWindow(Hwnd, SW_SHOWMAXIMIZED);

If you really "cannot store the handle" (is that what you meant by handler?) then you could consider using FindWindow. Sounds to me like you need to just store the window handle and then it'll be OK!

Upvotes: 2

Necrolis
Necrolis

Reputation: 26171

You want to use SW_RESTORE to redisplay your minimized window, to quote MSDN:

Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.

Upvotes: 5

Related Questions