简体   繁体   English

如何在最小化窗口后最大化窗口

[英]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) . 我使用nCmdShow = 3来最大化它,并使用nCmdShow = 6来使用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? 我如何实现同样的目标?

You want to use SW_RESTORE to redisplay your minimized window, to quote MSDN : 您想使用SW_RESTORE重新显示最小化窗口,引用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. 应用程序应在还原最小化窗口时指定此标志。

You need to call ShowWindow(Hwnd, SW_SHOWMAXIMIZED); 你需要调用ShowWindow(Hwnd, SW_SHOWMAXIMIZED);

If you really "cannot store the handle" (is that what you meant by handler?) then you could consider using FindWindow . 如果你真的 “无法存储句柄”(这是你的处理程序的意思吗?)那么你可以考虑使用FindWindow Sounds to me like you need to just store the window handle and then it'll be OK! 听起来像你只需要存储窗口句柄然后就可以了!

您可以通过Alt + Enter最小化窗口,并通过相同的键组合最大化窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM