Recent

Author Topic: expected pwidechar  (Read 8750 times)

whitehat

  • Jr. Member
  • **
  • Posts: 93
Re: expected pwidechar
« Reply #15 on: October 09, 2018, 08:48:42 pm »
Erreurs : 2
project1.lpr(21,5) Error: Wrong number of parameters specified for call to "WaitForSingleObject"
Error: Found declaration: WaitForSingleObject(QWord;LongWord):DWord;



Code: Pascal  [Select][+][-]
  1. program ex;
  2. uses
  3.   crt,
  4.   Windows,   // for constant SW_NORMAL
  5.   ShellApi;  // for function ShellExecute
  6. procedure createdatabase(nomdb: AnsiString);
  7. var
  8.   comand: AnsiString;
  9.   si: STARTUPINFOA;
  10.   pi: PROCESS_INFORMATION;
  11. begin
  12.   comand := 'C:\AppServ\MySQL\bin\mysql.exe -uroot -ptest1234 -e "create database ' + nomdb + ' ;"';
  13.  
  14.   ZeroMemory(@si, sizeof(si));
  15.   si.cb := sizeof(si);
  16.   si.dwFlags := STARTF_USESHOWWINDOW;
  17.   si.wShowWindow := SW_NORMAL;
  18.  
  19.   if CreateProcessA(nil, PAnsiChar(comand), nil, nil, False, 0, nil, nil, @si, @pi) then
  20.   begin
  21.     WaitForSingleObject(pi.hProcess);
  22.     CloseHandle(pi.hThread);
  23.     CloseHandle(pi.hProcess);
  24.   end else
  25.   begin
  26.     // error handling, use GetLastError() to find out why CreateProcess() failed...
  27.   end;
  28. end;
  29.  
  30. begin
  31.   createdatabase('hello');
  32. end.

whitehat

  • Jr. Member
  • **
  • Posts: 93
Re: expected pwidechar
« Reply #16 on: October 09, 2018, 09:19:51 pm »
i fixed with this line
Code: Pascal  [Select][+][-]
  1. WaitForSingleObject(pi.hProcess, INFINITE);
ty all guys  8-)

 

TinyPortal © 2005-2018