program sslazarus1; {$mode objfpc}{$H+} uses {$IFDEF UNIX} cthreads, {$ENDIF} {$IFDEF HASAMIGA} athreads, {$ENDIF} Interfaces, // this includes the LCL widgetset Forms, LCLIntf, LCLType, Windows, SysUtils, FullScrFormUnit, ConfigFormUnit, PreviewFormUnit { you can add units after this }; {$R *.res} var arg: string; phwnd: HWND; hMutex: THandle; const MUTEX_NAME: string = 'ScreenSaverLazarus1Mutex8686'; begin RequireDerivedFormResource := True; Application.Scaled := True; {$PUSH} {$WARN 5044 OFF} //Application.MainFormOnTaskbar := True; Application.MainFormOnTaskbar := False; {$POP} Application.Initialize; if ParamCount >= 1 then arg := LowerCase(Copy(ParamStr(1), 1, 2)) else arg := ''; if arg = '/s' then begin // Fullscreen mode hMutex := CreateMutex(nil, False, PChar(MUTEX_NAME)); if (hMutex = 0) or (GetLastError = ERROR_ALREADY_EXISTS) then begin if hMutex <> 0 then CloseHandle(hMutex); Exit; end; try Application.CreateForm(TFullScreenForm, FullScreenForm); Application.Run; finally if hMutex <> 0 then CloseHandle(hMutex); end; end else if arg = '/c' then begin // Config mode Application.CreateForm(TConfigForm, ConfigForm); Application.Run; Exit; end else if arg = '/p' then begin // Preview mode if ParamCount >= 2 then phwnd := HWND(StrToInt64Def(ParamStr(2), 0)) else phwnd := 0; Application.CreateForm(TPreviewForm, PreviewForm); if phwnd <> 0 then PreviewForm.EmbedIntoParent(phwnd); Application.Run; end else begin // Config mode Application.CreateForm(TConfigForm, ConfigForm); Application.Run; end; end.