procedure TfmOpen.Button1Click(Sender: TObject);
{$define WIDE} // если Unicode
var
cmdLine, fName: {$ifdef WIDE}WideString{$else}string{$endif};
si: TStartupInfo;
pi: TProcessInformation;
begin
cmdLine := '"C:\Program Files\Light Alloy\LA.exe" /Play ';
fName := '"'+ FileListBox.FileName +'"';
// WinExec(PChar(cmdLine + fName), SW_SHOW); // только для string
FillChar(si, SizeOf(si), #0);
with si do begin
cb := SizeOf(si);
dwFlags := STARTF_USESHOWWINDOW;
wShowWindow := SW_SHOW;
end;
if {$ifdef WIDE}CreateProcessW{$else}CreateProcessA{$endif}(
nil, // lpApplicationName,
{$ifdef WIDE}pWideChar{$else}pChar{$endif}(cmdLine + fName), // lpCommandLine,
nil, // lpProcessAttributes,
nil, // lpThreadAttributes,
True, // bInheritHandles,
0, // dwCreationFlags
nil, // lpEnvironment,
nil, // lpCurrentDirectory,
si, // lpStartupInfo,
pi) then begin // lpProcessInformation
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
end;
end;