如何构建VB6控制台应用程序

时间:2022-10-01 20:47:43

I did some googling to try to answer this question but even after that I'm not quite clear about something. Is it possible to create a console app from VB6?

我做了一些谷歌搜索试图回答这个问题,但即使在那之后我也不太清楚。是否可以从VB6创建一个控制台应用程序?

I've got a VB6 app that doesn't put up a window. I always assumed that it was a console app. However, I want to be able to use the Windows API SetConsoleCtrlHandler function from within it. I believe that with C++/MFC apps you have to set a linker switch to create a console app. And one of my fellow developers told me that VB6 doesn't create a true console app and therefore this would not work. So is it possible to create a console app that Windows will recognize as a console app from VB6?

我有一个没有窗口的VB6应用程序。我一直认为它是一个控制台应用程序。但是,我希望能够在其中使用Windows API SetConsoleCtrlHandler函数。我相信使用C ++ / MFC应用程序,您必须设置链接器开关以创建控制台应用程序。我的一位开发人员告诉我,VB6没有创建一个真正的控制台应用程序,因此这不起作用。那么有可能创建一个Windows将从VB6识别为控制台应用程序的控制台应用程序吗?

Platform: Windows XP SP2

平台:Windows XP SP2

Development Platform: VB6

开发平台:VB6

3 个解决方案

#1


8  

Yes. It's also possible to create totally headless applications (which I've done a few times in the past). This link gives an example with a code snippet.

是。它也可以创建完全无头的应用程序(我过去曾做过几次)。此链接提供了一个包含代码段的示例。

#2


3  

You can use Karl E. Peterson's code at http://vb.mvps.org/samples/project.asp?id=Console to create a very full-featured console application.

您可以在http://vb.mvps.org/samples/project.asp?id=Console上使用Karl E. Peterson的代码来创建功能齐全的控制台应用程序。

Simpler ones can be made by relinking the compiled VB6 EXE for the console subsystem. Karl goes into this at that same Web page. Scroll down for LinkConsole.vbs there.

可以通过重新编译控制台子系统的已编译VB6 EXE来实现更简单的操作。卡尔在同一个网页上进入了此页面。在那里向下滚动LinkConsole.vbs。

#3


1  

See this article.

看到这篇文章。

Or you could rewrite the VB6 app as a VBScript program.

或者你可以将VB6应用程序重写为VBScript程序。

#1


8  

Yes. It's also possible to create totally headless applications (which I've done a few times in the past). This link gives an example with a code snippet.

是。它也可以创建完全无头的应用程序(我过去曾做过几次)。此链接提供了一个包含代码段的示例。

#2


3  

You can use Karl E. Peterson's code at http://vb.mvps.org/samples/project.asp?id=Console to create a very full-featured console application.

您可以在http://vb.mvps.org/samples/project.asp?id=Console上使用Karl E. Peterson的代码来创建功能齐全的控制台应用程序。

Simpler ones can be made by relinking the compiled VB6 EXE for the console subsystem. Karl goes into this at that same Web page. Scroll down for LinkConsole.vbs there.

可以通过重新编译控制台子系统的已编译VB6 EXE来实现更简单的操作。卡尔在同一个网页上进入了此页面。在那里向下滚动LinkConsole.vbs。

#3


1  

See this article.

看到这篇文章。

Or you could rewrite the VB6 app as a VBScript program.

或者你可以将VB6应用程序重写为VBScript程序。