carrera Posted April 26, 2018 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
Oliver Morsch Posted April 26, 2018 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
carrera Posted April 26, 2018 Author 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
Wilton Ergon Posted April 27, 2018 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
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.