![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#2
|
|||
|
|||
|
Juan, utiliza esta rutina para firmar archivos xml utilizando rutina.jar
txtComando.Text:='c:\jdk1.7.0_13\bin\java -jar rutina.jar firma archivos.xml archivo_salida.xml ; txtSalida.Text := ejecutarComando(txtComando.Text); function ejecutarComando (comando : string) : string; var Buffer: array[0..4096] of Char; si: STARTUPINFO; sa: SECURITY_ATTRIBUTES; sd: SECURITY_DESCRIPTOR; pi: PROCESS_INFORMATION; newstdin, newstdout, read_stdout, write_stdin: THandle; exitcod, bread, avail: Cardinal; begin Result:= ''; if IsWinNT then begin InitializeSecurityDescriptor(@sd, SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(@sd, true, nil, false); sa.lpSecurityDescriptor := @sd; end else sa.lpSecurityDescriptor := nil; sa.nLength := sizeof(SECURITY_ATTRIBUTES); sa.bInheritHandle := TRUE; if CreatePipe(newstdin, write_stdin, @sa, 0) then begin if CreatePipe(read_stdout, newstdout, @sa, 0) then begin GetStartupInfo(si); with si do begin dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW; wShowWindow := SW_HIDE; hStdOutput := newstdout; hStdError := newstdout; hStdInput := newstdin; end; Fillchar(Buffer, SizeOf(Buffer), 0); GetEnvironmentVariable('COMSPEC', @Buffer, SizeOf(Buffer) - 1); StrCat(@Buffer,PChar(' /c ' + comando)); if CreateProcess(nil, @Buffer, nil, nil, TRUE, CREATE_NEW_CONSOLE, nil, nil, si, pi) then begin repeat PeekNamedPipe(read_stdout, @Buffer, SizeOf(Buffer) - 1, @bread, @avail, nil); if bread > 0 then begin Fillchar(Buffer, SizeOf(Buffer), 0); ReadFile(read_stdout, Buffer, bread, bread, nil); Result:= Result + String(PChar(@Buffer)); end; Application.ProcessMessages; GetExitCodeProcess(pi.hProcess, exitcod); until (exitcod <> STILL_ACTIVE) and (bread = 0); end; CloseHandle(read_stdout); CloseHandle(newstdout); end; CloseHandle(newstdin); CloseHandle(write_stdin); end; end; saludos jgutti |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Ejecutar archivo desde un recurso | broly7 | Varios | 5 | 18-04-2011 02:25:21 |
| ejecutar archivo .kml desde php | richy08 | PHP | 0 | 26-09-2008 23:02:05 |
| como ejecutar archivo *.bat desde delphi 7 | kurono | Varios | 6 | 27-08-2007 04:42:48 |
| Ejecutar un archivo HTML Help(*.CHM), desde Delphi | Majo | API de Windows | 3 | 26-11-2004 10:10:27 |
|