Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 880
Nohsib Avatar asked Nov 05 '22 10:11

Nohsib


2 Answers

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.

like image 176
Necrolis Avatar answered Nov 14 '22 12:11

Necrolis


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!

like image 39
noelicus Avatar answered Nov 14 '22 13:11

noelicus