如何获取控制台窗口的WM_MINIMIZE消息? [英] How can i get the WM_MINIMIZE message of console window?

查看:300
本文介绍了如何获取控制台窗口的WM_MINIMIZE消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想处理WM_MINIMIZE消息,因为我需要满足以下情况.
如果用户单击最小化"按钮,则将其隐藏到启动栏.如果用户单击启动栏上的图标,则照常显示.

I want to process the WM_MINIMIZE msg, because I need to satisfy such a situation as follow.
If user click the "minimize" button,I hide it to the startup bar.If the user click the icon on the startup bar, I display it as usual.

推荐答案

可能不是一个好主意,请看下面的讨论 [
Probably it isn''t a good idea, have a look at the following discussion "Message handling in a console app"[^].


问题尚不完全清楚,如果可以,抱歉m解决了一个错误的问题...

这不是窗口应用程序.关闭窗户时,已经来不及了.
相反,您可以在控制台应用程序中拦截Ctrl+C来执行致命的操作,例如适当的清理.

参见
http://stackoverflow.com/questions/1641182/how -can-i-catch-a-ctrl-c-event-c [
The question is not completely clear, so sorry if I''m addressing a wrong problem…

This is not a Windowed application. When a windows is closed, it''s already too late.
Instead, you can intercept Ctrl+C in your console application to perform post-mortal actions such as proper clean-up.

See http://stackoverflow.com/questions/1641182/how-can-i-catch-a-ctrl-c-event-c[^].

—SA


mengfei929,

我过去使用PeekMessage函数完成了此操作.这是一篇涉及该主题的文章:
将Windows添加到控制台应用程序 [ ^ ]

希望这会有所帮助..
mengfei929,

I''ve done this in the past using the PeekMessage function.. Here''s an article that touches on the subject: Adding Windows To Your Console Application[^]

Hopefully, this will help..


这篇关于如何获取控制台窗口的WM_MINIMIZE消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆