简体   繁体   English

您可以在控制台程序中创建启动窗口吗?

[英]Can you create a start-up window in console program?

I want to a create dialog box like window before displaying the console window. 我想在显示控制台窗口之前创建一个类似于window的对话框。 I haven't actually tried anything yet but was just wondering if it can be displayed as a start-up window. 我实际上尚未尝试任何操作,只是想知道是否可以将其显示为启动窗口。

If you compile your win32 application as a console app, the console window will appear before you get a chance to do anything else. 如果将win32应用程序编译为控制台应用程序,则在有机会执行其他操作之前,将出现控制台窗口。

To get around this, you need to use a windows application - this won't display a console window at all by default. 要解决此问题,您需要使用Windows应用程序-默认情况下,该应用程序根本不会显示控制台窗口。 Some time after startup you can then call AllocConsole to create a console window. 启动一段时间后,您可以调用AllocConsole创建控制台窗口。

I'm not sure, but if it's a windowed application already, it might be worth making your own console window to redirect standard IO. 我不确定,但是如果它已经是一个窗口应用程序,则可能值得制作自己的控制台窗口来重定向标准IO。 It'll certainly look nicer. 它肯定看起来会更好。 If you want the exact behavior of the regular console, such as the same copy/paste, you'd have to reimplement it. 如果您想要常规控制台的确切行为,例如相同的复制/粘贴,则必须重新实现它。

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

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