Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   WinExecAndWait32 (https://www.clubdelphi.com/foros/showthread.php?t=6929)

Aztaroth 28-01-2004 01:07:31

WinExecAndWait32
 
Tengo esta funcion en delphi 7

function WinExecAndWait32(FileName:String; Visibility:integer):integer;
var
zAppName:array[0..512] of char;
zCurDir:array[0..255] of char;
WorkDir:String;
StartupInfo:TStartupInfo;
ProcessInfo:TProcessInformation;
Resultado,exitCode: DWord;
begin
StrPCopy(zAppName,FileName);
GetDir(0,WorkDir);
StrPCopy(zCurDir,WorkDir);
FillChar(StartupInfo,Sizeof(StartupInfo),#0);
StartupInfo.cb := Sizeof(StartupInfo);

StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow := Visibility;
CreateProcess(nil,
zAppName, { pointer to command line string }
nil, { pointer to process security attributes}
nil, { pointer to thread security attributes}
false, { handle inheritance flag }
CREATE_NEW_CONSOLE or { creation flags }
NORMAL_PRIORITY_CLASS,
nil, { pointer to new environment block }
nil, { pointer to current directory name }
StartupInfo, { pointer to STARTUPINFO }
ProcessInfo);

{Espera a que termine la ejecucion}
{Wait until execution finish}
repeat
exitCode := WaitForSingleObject( ProcessInfo.hProcess,1000);
Application.ProcessMessages;
until (exitCode <> WAIT_TIMEOUT);
GetExitCodeProcess(ProcessInfo.hProcess,Resultado);
//MessageBeep(0);
CloseHandle(ProcessInfo.hProcess );
Result:=Resultado;
end;

la vi en TMania y la implemente en mi programa, el problema es que corre bien en Windows XP pero no quiere funcionar en W98 o W2K, alguna sugerencia para este problema.

Gracias.

roman 28-01-2004 01:24:02

Por lo menos podrías explicarnos qué se supone que hace la función y en qué consiste el no funcionar. Así tendrás más posibilidades de obtener ayuda.

// Saludos

delphi.com.ar 02-02-2004 16:19:36

Te recomiendo este hilo: http://www.clubdelphi.com/foros/arch...ic.php?t=20317

Saludos!


La franja horaria es GMT +2. Ahora son las 22:58:27.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi