ADD: Command line parameter "--no-console" to hide debug console window

This commit is contained in:
Alexander Koblov 2011-04-26 03:37:29 +00:00
commit 68016688ba
2 changed files with 15 additions and 2 deletions

View file

@ -275,13 +275,14 @@ function mbLoadLibrary(const Name: UTF8String): TLibHandle;
function mbSysErrorMessage(ErrorCode: Integer): UTF8String;
procedure FixFormIcon(Handle: LCLType.HWND);
procedure HideConsoleWindow;
implementation
uses
FileUtil, uDebug, uDCUtils, uGlobs
{$IF DEFINED(MSWINDOWS)}
, Windows, uNTFSLinks, uMyWindows, JwaWinNetWk, uShlObjAdditional
, JwaWinCon, Windows, uNTFSLinks, uMyWindows, JwaWinNetWk, uShlObjAdditional
{$ENDIF}
{$IF DEFINED(UNIX)}
, BaseUnix, Unix, uMyUnix, dl
@ -1814,4 +1815,11 @@ begin
{$ENDIF}
end;
procedure HideConsoleWindow;
begin
{$IFDEF WINDOWS}
if isConsole then ShowWindow(GetConsoleWindow, SW_HIDE);
{$ENDIF}
end;
end.

View file

@ -9,7 +9,7 @@ procedure ProcessCommandLineParams;
implementation
uses
uDCUtils, uGlobsPaths, FileUtil;
uDCUtils, uGlobsPaths, FileUtil, uOSUtils;
procedure ProcessCommandLineParams;
var
@ -22,6 +22,11 @@ begin
param := ParamStrUTF8(i);
if StrBegins(param, '--config-dir=') then
gpCmdLineCfgDir := TrimQuotes(Copy(param, 1 + Length('--config-dir='), MaxInt));
{$IF DEFINED(NIGHTLY_BUILD)}
if StrBegins(param, '--no-console') then
HideConsoleWindow;
{$ENDIF}
end;
end;