[Lazarus] Fwd: Help clarify use of TApplication with tiOPF example.
Sven Barth
pascaldragon at googlemail.com
Sun Mar 13 09:43:36 CET 2011
Am 13.03.2011 00:22, schrieb Frank Church:
> I am using 0.9.28,3 with FPC 2,4,0 on Window.
>
> I further reduced it to this
>
> program Demo_LoadPersistenceLayerIfDef_Laz;
>
> {$mode objfpc}{$H+}
>
> uses
> {$IFDEF UNIX}{$IFDEF UseCThreads}
> cthreads,
> {$ENDIF}{$ENDIF}
> Interfaces, // this includes the LCL widgetset
> Forms, //frmMain,
> //LResources,
>
> DemoDBUtils in '..\Common\DemoDBUtils.pas';
>
> {$IFDEF WINDOWS}{$R Demo_LoadPersistenceLayerIfDef_Laz.rc}{$ENDIF}
You can disable this one, too.
>
> begin
> //{$I Demo_LoadPersistenceLayerIfDef_Laz.lrs}
> Application.Initialize;
> //Application.CreateForm(TForm1, Form1);
> //Application.Run;
> ShowConnectedDatabases;
> end.
>
>
> Thanks for your response.
>
> And it looks like Application requires Interfaces and Forms, and from
> what you describe the ShowConnectedDatabases is probably only working at
> the end of the program's execution.
As you've disabled the "Application.Run" call it will work immediatly
(if at all), because the potentially endless main loop is not started.
> Is it possible that a GUI app will
> work without TApplication on Windows, or at the least one that requires
> only the dialog?
You can try to disable the "Application.Initialize" call as well to see
what happens, but I can't tell what the Win32 LCL needs to show a simple
dialog...
Note: If you can successfully remove this call, you can remove the usage
of unit "Forms" as well. The unit "Interfaces" must be kept though and
if you don't need threads (on non-Windows) you can remove the part
containing "cthreads" as well.
Regards,
Sven
More information about the Lazarus
mailing list