Erreurs : 2
project1.lpr(21,5) Error: Wrong number of parameters specified for call to "WaitForSingleObject"
Error: Found declaration: WaitForSingleObject(QWord;LongWord):DWord;
program ex;
uses
crt,
Windows, // for constant SW_NORMAL
ShellApi; // for function ShellExecute
procedure createdatabase(nomdb: AnsiString);
var
comand: AnsiString;
si: STARTUPINFOA;
pi: PROCESS_INFORMATION;
begin
comand := 'C:\AppServ\MySQL\bin\mysql.exe -uroot -ptest1234 -e "create database ' + nomdb + ' ;"';
ZeroMemory(@si, sizeof(si));
si.cb := sizeof(si);
si.dwFlags := STARTF_USESHOWWINDOW;
si.wShowWindow := SW_NORMAL;
if CreateProcessA(nil, PAnsiChar(comand), nil, nil, False, 0, nil, nil, @si, @pi) then
begin
WaitForSingleObject(pi.hProcess);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
end else
begin
// error handling, use GetLastError() to find out why CreateProcess() failed...
end;
end;
begin
createdatabase('hello');
end.