[fpc-pascal] Program without window but messages

JC Chu jcchu at acm.org
Wed Apr 25 18:34:24 CEST 2012

As leledumbo has pointed out, you need to call Application.Initialize()
before using LCL features.  The code for TApplication.Initialize() shows
that it initializes the currently active widget set, which is maintained
by the Interfaces unit.  ShowMessage() relies ultimately upon
TWidgetSet.PromptUser(), and that is why TApplication.Initialize() is

On April 26, at 00:04, J├╝rgen Hestermann wrote:

> JC Chu schrieb:
>> Try this.
>> program Test;
>> uses
>>   {$IF Defined(UNIX) and Defined(UseCThreads)}cthreads,{$ENDIF}
>>   Interfaces, Forms, Dialogs;
>> begin
>>   Application.Initialize;
>>   ShowMessage('Test');
>> end.
>                             Yes, this works!
> Now I only need to understand why. ;-)
> I was expecting the "application.initialize" to create a
> window so I omitted it.
> What does the initialize routine?
> Why is it needed?
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Best Regards,
JC Chu

More information about the fpc-pascal mailing list