编写GUI和控制台双模式程序

program RegH2;

uses
SysUtils,
Windows,
Forms,
CMain in 'CMain.pas' {FormMain},
H2Reg in 'H2Reg.pas',
WbemScripting_TLB in '..\..\Imports\WbemScripting_TLB.pas';

{$R *.res}

begin
if ParamCount = 0 then
begin
Application.Initialize;
Application.CreateForm(TFormMain, FormMain);
Application.Run;
end
else
begin
AllocConsole;
try
Writeln('Usage:RegH2 -help');
Writeln('Please Enter to terminate...');
Readln;
finally
FreeConsole;
end;
end;
end.