carrera 0 Posted April 26, 2018 Share Posted April 26, 2018 hi, Is it possible to execute application (exe or cmd) on service side and wait for finish, before sending the file to client Thanks for any advice Quote Link to post Share on other sites
Oliver Morsch 51 Posted April 26, 2018 Share Posted April 26, 2018 If it is a console app you can use CreateProcess. Or see here: http://forums.unigui.com/index.php?/topic/3529-webcmd-start-a-command-line-console-app-in-browser-interactive/?fromsearch=1 Quote Link to post Share on other sites
carrera 0 Posted April 26, 2018 Author Share Posted April 26, 2018 If it is a console app you can use CreateProcess. Or see here: http://forums.unigui.com/index.php?/topic/3529-webcmd-start-a-command-line-console-app-in-browser-interactive/?fromsearch=1 thanks Quote Link to post Share on other sites
wilton_rad 46 Posted April 27, 2018 Share Posted April 27, 2018 eu usso isso: {CHAMA EXECUTAVEL PASSANDO PARAMETROS, ESPERA FINALIZACAO DO MESMO} function ExecutaeAguarda(const FileName, Params:String; const WindowState: Word): boolean; var SUInfo: TStartupInfo; ProcInfo: TProcessInformation; CmdLine:String; begin result :=false; if (NOT FILEEXISTS(FileName)) and (pos('\',FileName)>0) then BEGIN alerta('Arquivo '+FileName+#13+'não foi encontrado!'); exit; END; CmdLine := '"' + Filename + '"' + Params; FillChar(SUInfo, SizeOf(SUInfo), #0); With SUInfo do begin cb := SizeOf(SUInfo); dwFlags := STARTF_USESHOWWINDOW; wShowWindow := WindowState; end; Result := CreateProcess(nil, PChar(CmdLine), nil, nil, false, CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil, PChar(ExtractFilePath(Filename)), SUInfo, ProcInfo); if Result then begin WaitForSingleObject(ProcInfo.hProcess, INFINITE); CloseHandle(ProcInfo.hProcess); CloseHandle(ProcInfo.hThread); end; end; params :='"PARAM" "PARAM2" "PARAM3"'; ExecutaeAguarda(UniServerModule.ServerRoot+'\yourexe.exe',params,SW_NORMAL) //SW_MINIMIZE SW_HIDE .... Quote Link to post Share on other sites
carrera 0 Posted April 29, 2018 Author Share Posted April 29, 2018 Thanks @wilton_rad Quote Link to post Share on other sites
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.