Search the Community
Showing results for tags 'service'.
-
Being new at uniGUI I created one of my first system in desktop mode. Now I want to take that same application and get it running under a Windows service. If I create a new service type application with nothing in it, it looks like the app is launched using this code if not Application.DelayInitialize or Application.Installing then Application.Initialize; Application.CreateForm(TUniServiceModule, UniServiceModule); Application.Run; From an earlier post, I have set up my project with DEFINES like this When running in VCL, this it how things are started and all works well {$IFDEF UNIGUI_VCL} ReportMemoryLeaksOnShutdown:=True; // Optional. Application.Initialize; TUniServerModule.Create(Application); Application.CreateForm(TUniServiceModule, UniServiceModule); Application.Run; {$ENDIF} When running as a service, I'm assuming this is how things are started. {$IFDEF UNIGUI_SERVICE} if not Application.DelayInitialize or Application.Installing then Application.Initialize; Application.CreateForm(TMyServiceClass, MyServiceClass); // Get from your service module. Application.Run; {$ENDIF} I'm assuming that I have to kick off the project through the ServiceModule? I'm not sure what to change this line to: Application.CreateForm(TMyServiceClass, MyServiceClass); // Get from your service module. If I change to this, and I open the application, I just get a blank browser and it looks hung. Application.CreateForm(TUniServiceModule, UniServiceModule); BTW: I was able to get the application installed as a service and am able to start and stop the server without issues.
-
Standalone Server can run another application. ------------------------------------------------------------- Procedure WinExecAndWait(CommandLine:String); var ComLineBuffer: array[0..512] of char; StartupInfo: TStartupInfo; ProcessInfo: TProcessInformation; Re:Cardinal; begin StrPCopy(ComLineBuffer,CommandLine); FillChar(StartupInfo, Sizeof(StartupInfo), #0); StartupInfo.cb := Sizeof(StartupInfo); StartupInfo.dwFlags := STARTF_USESHOWWINDOW; StartupInfo.wShowWindow := SW_HIDE; if CreateProcess(nil, ComLineBuffer, { pointer to command line string } nil, { pointer to process security attributes } nil, { pointer to thread security attributes } True, { handle inheritance flag } CREATE_NEW_CONSOLE or { creation flags } NORMAL_PRIORITY_CLASS, nil, { pointer to new environment block } nil, { pointer to current directory name, PChar} StartupInfo, { pointer to STARTUPINFO } ProcessInfo) { pointer to PROCESS_INF } then begin WaitforSingleObject(ProcessInfo.hProcess, INFINITE); GetExitCodeProcess(ProcessInfo.hProcess, Re); CloseHandle(ProcessInfo.hProcess); { to prevent memory leaks } CloseHandle(ProcessInfo.hThread); end; end; ------------------------------------------------------------------------ Windows Service Server can run not another application. Thanks.
-
Hi, I currently have a project that i created as a service, is there a easy way to convert the project to a ISAPI module? Best regards Christian J