什么时候System.IsConsole在Delphi中真的? [英] When is System.IsConsole true in Delphi?

查看:203
本文介绍了什么时候System.IsConsole在Delphi中真的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据System.pas,它被记录为 True如果编译为控制台应用程序。在System.pas中,还有一个赋值

  {$ IFDEF LINUX} 
IsConsole:= True;
...



我有一个奇怪的问题,一个应用程序是从一个Delphi应用程序,使用ShellExecute,然后它运行到此代码,引发(意外)异常

 如果System.IsConsole然后
raise Exception.Create(Msg)

应用程序未使用 Project / Options / Linking / Generate console application

请注意,在 Delphi XE2 中,OSX应用程序可以不使用此变量,因为它总是为真。请参见 QC条目98956 为什么我的OSX FireMonkey应用程序认为它是控制台应用程序?

解决方案

发现它:使用dcc32.exe和dpr / cfg文件创建了可执行文件,cfg包含一行



<$创建控制台应用程序的p $ p> -cc



Delphi 2009 Enterprise IDE在项目/选项/链接/生成控制台应用程序对话框中不显示此设置。该应用程序从旧的Delphi版本移植,并且可能是多年来出了点问题。


According to System.pas, it is documented as True if compiled as console app. In System.pas, there is also an assignment

{$IFDEF LINUX}
  IsConsole := True;
...

I have a strange problem where an app is launched from a Delphi app, using ShellExecute, and then it runs into this code, raising the (unexpected) exception

  if System.IsConsole then
    raise Exception.Create(Msg)

The application is not compiled with Project/Options/Linking/Generate console application. What else could set IsConsole to true?


Note that in Delphi XE2, OSX applications can not use this variable as it is always true. See QC Entry 98956 and Why Does My OSX FireMonkey App Think It Is a Console App ?

解决方案

Found it: the executable has been created using dcc32.exe and the dpr / cfg file, the cfg contains a line

-cc

which creates a console application.

The Delphi 2009 Enterprise IDE does not show this setting in the Project/Options/Linking/Generate console application dialog. The application was ported from an older Delphi version and maybe something went wrong over the years.

这篇关于什么时候System.IsConsole在Delphi中真的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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