alesf76 Posted December 28, 2017 Share Posted December 28, 2017 Is it possible to make an unigui application, i.e. a single executable, work both as a console one when started normally and as a service when installed and started as a service ? I'm using the professional edition. I did it for intraweb apps years ago. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 28, 2017 Share Posted December 28, 2017 This post can help you: http://forums.unigui.com/index.php?/topic/9117-convert-a-project-from-desktop-to-service/ Quote Link to comment Share on other sites More sharing options...
pedrisco Posted December 28, 2017 Share Posted December 28, 2017 I use a command line parameter to say the application to run as a process or as a service. I'm sure there is a better way, but it works for me. The dpr looks like this... program main;uses SvcMgr, ServiceModule in 'ServiceModule.pas' {mainWebService: TUniGUIService}, Forms, Windows, Classes, SysUtils, ServerModule in 'ServerModule.pas' {UniServerModule: TUniGUIServerModule}, Login in 'Login.pas' {LoginForm: TUniLoginForm}, MainModule in 'MainModule.pas' {UniMainModule: TUniGUIMainModule}, Main in 'Main.pas' {MainForm: TUniForm};{$R *.res}begin if upperCase( paramStr(1) ) <> '/APP' then with SvcMgr.Application do begin //started at system32... SetCurrentDir( extractFileDir(paramStr(0)) ); if not DelayInitialize or Installing then Initialize; CreateForm(TmainVstWebService, mainVstWebService); Run; end else with Forms.Application do begin Initialize; TUniServerModule.Create(Forms.Application); Run; end;end. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.