Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi WaitForSingleObject mal anders... (https://www.delphipraxis.net/59540-waitforsingleobject-mal-anders.html)

NeoXan 23. Dez 2005 21:53


WaitForSingleObject mal anders...
 
Ich würde gerne überprüfen ob eine Application ordentlich gestartet wurde. In diesem Falle ein mySQL Server...

Delphi-Quellcode:
procedure ShellExecute_AndWait(FileName: string; Params: string);
var
  exInfo: TShellExecuteInfo;
  Ph: DWORD;
begin
  FillChar(exInfo, SizeOf(exInfo), 0);
  with exInfo do
  begin
    cbSize := SizeOf(exInfo);
    fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT;
    Wnd := GetActiveWindow();
    ExInfo.lpVerb := 'open';
    ExInfo.lpParameters := PChar(Params);
    lpFile := PChar(FileName);
    nShow := SW_SHOWNORMAL;
  end;
  if ShellExecuteEx(@exInfo) then
    Ph := exInfo.HProcess
  else
  begin
    ShowMessage(SysErrorMessage(GetLastError));
    Exit;
  end;
  while WaitForSingleObject(ExInfo.hProcess, 50) <> WAIT_OBJECT_0 do
    Application.ProcessMessages;
  CloseHandle(Ph);
end;

  ShellExecute_AndWait('C:\mysql\bin\mysqld-nt.exe', ''
Danke schonmal im Vorraus und verzeihung, wenn ich eine etwaige Antwort übersehen habe...

toms 23. Dez 2005 22:02

Re: WaitForSingleObject mal anders...
 
ShellExecuteEx Function --> MSDN

NeoXan 23. Dez 2005 23:57

Re: WaitForSingleObject mal anders...
 
ok stimmt...

Also eigentlich meinte ich das so...wenn ich mysql-nt z.B. aufrufe, dann dauert es ja eine Weile eh die DB fertig geladen ist. Und DAS wollte ich eigentlich abfragen...anscheinend ginge das nicht...hmmm, "Notlösung" wäre, dass ich das Konsolenfenster nach einen Needle durchsuche ;)

vielen Danke
Florian


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:45 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz