Quote:
|
Originally Posted by Megalexxx
It won't be enough...
Create a thread (look for it in Delphi's help), and then, call your converter inside this thread.
|
Look, i was doing this?
for i:=1
to Lst_Items.Items.Count
do
(verify itens. Count one, by one)
begin
frm_adx2mp3.Update; (i tried to use this method to avoid white screens, but it doesn't works. ._.)
Origem:=GetShortFileName(Lst_Items.Items[0].caption)+' '+GetShortFileName(Relativo)+ExtractName(Extractfi lename(Lst_Items.Items[0].Caption))+'.mp3';
(var that receives the source of the ADX files and rename then to MP3 with the destiny selected at the start of this procedure)
ExecAndWait(Pchar(Aplicativo), Pchar(Origem), SW_HIDE);
(runs the funtion ExecAndWait to run the program and wait for the end to continue. The variable Aplicativo have received a string source of the program with the function at start of this procedure:
Aplicativo:=ExtractFilePath( Application.ExeName )+'NAME OF APLICATON'
Lst_Items.items[0].delete;
(delete the first item of the list, to the program run the next one)
end;
----
function ExecAndWait(const FileName, Params: string;
const WindowState: Word): boolean;
var
SUInfo: TStartupInfo;
ProcInfo: TProcessInformation;
CmdLine: string;
begin
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;
This was the function that i have used to use an external program.
---
I have an ideia! =)
Can you give me an example to avoid this with another type of program?
If you still on my place, what you will do?