如何最小化命令(控制台)窗口没有闪烁 [英] How to Command(console) window minimised without any flicker

查看:90
本文介绍了如何最小化命令(控制台)窗口没有闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在VS2005上工作.我已将链接器->系统->子系统设置为控制台(/SUBSYSTEM:CONSOLE),因为我需要命令窗口在运行时检查项目的运行状态.
我要在最小化命令窗口的情况下启动我的应用程序.
问题是,每当我的应用程序启动时,命令窗口就会进入最大化状态.
如果我使用:
最小化此窗口

Hi All,
I am working on VS2005. I have set the linkers->system->subsystem to Console (/SUBSYSTEM:CONSOLE) as I need the command window to check runtime status of my project at runtime.
I want to launch my application with the command window minimized.
The problem is, whenever my application launches, the command window comes in maximize state.
If I minimize this window using :

<br />
   HWND hWnd = GetConsoleWindow();  <br />
   ShowWindow( hWnd, SW_MINIMIZE ); <br />



仍然闪烁,例如,瞬间打开命令窗口,然后最小化.
如何在最小化命令窗口的情况下启动应用程序,没有任何闪烁?


问候,
Prashant Mohod



still I get a flicker, ie for a split second the command window opens and then minimizes.
How can I launch my application with the command window in minimized state, without any flicker?


Regards,
Prashant Mohod

推荐答案

一个简单的解决方案是创建快捷方式-右键单击可执行文件,然后选择创建快捷方式",右键单击资源管理器中的快捷方式对象,然后选择属性" -在快捷方式页面上选择运行":已最小化.无需编码:)

您可以使用 ShellExecute [
如果使用ShellExecute函数,则不需要快捷方式,只需指定SW_SHOWMINNOACTIVE.


问候
Espen Harlinn
A simple solution is to create a shortcut - right click executable and select "Create Shortcut", right click on the shortcut object in explorer and select "Properties" - on the shortcut page select "Run": minimized. No coding required :)

You can use ShellExecute[^] to "execute" the shortcut programatically.

If you use the ShellExecute function, you will not need the shortcut, just specify SW_SHOWMINNOACTIVE.


Regards
Espen Harlinn


您可以尝试将其移出桌面(将左上角/左角设置为屏幕分辨率之外的点),显示/最小化,然后重置屏幕坐标,因此当用户单击工具栏中的图标时,它将在屏幕上弹出.

编辑===========

寻找另一种方法来最小化控制台窗口.也许使用SetWindowPos或类似的东西.您的问题是您正在调用ShowWindow,很自然地,这就是在应用最小化操作之前要做的事情.也许您可以使用PostMessage将消息发送到控制台窗口以使其自身最小化
You could try moving it off the desktop (set the top/left corner to a point that is outside the resolution of the screen), show/minimize it, and the reset the screen coords so it will popup on the screen when the user clicks its icon in the toolbar.

EDIT ===========

Find a different way to minimize the console window. Maybe use SetWindowPos or something like that. Your problem is that you''re calling ShowWindow, so naturally, that''s what it''s going to do before it applies the minimization action. Maybe you could use PostMessage to send a message to the console window to minimize itself


这篇关于如何最小化命令(控制台)窗口没有闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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