Try to get results from mame64.exe like the -listfull or the -createconfig but in the first ShellExecute command i get result in the second i get nothing
I use this code
begin
vDir:= 'C:\Emu\Mame\Mame64.exe';
vDir2:= 'C:\Emu\Mame\gamelist.txt';
ShellExecute(0, nil, 'cmd.exe',PChar('/C '+ vDir +' -listfull > '+ vDir2),nil, SW_HIDE);
sleep(1000);
ShellExecute(0, nil, 'cmd.exe',PChar('/C '+ vDir +' -createconfig'),nil, SW_HIDE);
sleep(1000);
end;
I can't understand where i have wrong...
The mame.ini
file will be created in the working directory. You don't specify that, so it is inherited from the calling process. Look for it in the working directory of the calling process, likely the directory where your Delphi executable resides.
Using Sleep
isn't a very good idea. Don't use ShellExecute
to create the cmd.exe
process. Use CreateProcess
. Then wait on the returned process handle to be signaled if you need to synchronize. If you wanted to be even more advanced you'd create the mame64
process directly and use an anonymous pipe that you created as its stdout. Then you could avoid having to write any files at all.