{"id":188,"date":"2007-05-12T16:49:37","date_gmt":"2007-05-12T14:49:37","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/execandwait-launchappandwait-fur-delphi\/"},"modified":"2007-05-12T16:49:39","modified_gmt":"2007-05-12T14:49:39","slug":"execandwait-launchappandwait-fur-delphi","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/execandwait-launchappandwait-fur-delphi\/","title":{"rendered":"ExecAndWait (LaunchAppAndWait f\u00fcr Delphi)"},"content":{"rendered":"<p>&#8212;&#8211;<br \/>\navailable WindowStates:<\/p>\n<p>SW_SHOWDEFAULT<br \/>\nSW_SHOW<br \/>\nSW_SHOWMINIMIZED<br \/>\nSW_SHOWMAXIMIZED<br \/>\n&#8230; look at Windows-API<br \/>\n&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>[code lang=&#8221;delphi&#8221;]function ExecAndWait(const Filename, Params: string;<br \/>\n                           WindowState: word): boolean;<br \/>\nvar<br \/>\n  SUInfo: TStartupInfo;<br \/>\n  ProcInfo: TProcessInformation;<br \/>\n  CmdLine: string;<br \/>\nbegin<br \/>\n  \/\/Dateinamen in Anf\u00fchrungszeichen wg. langer Dateinamen mit Blanks<br \/>\n  CmdLine := &#8216;&#8221;&#8216; + Filename + &#8216;&#8221;&#8216; + Params;<\/p>\n<p>  FillChar(SUInfo, SizeOf(SUInfo), #0);<br \/>\n  with SUInfo do<br \/>\n  begin<br \/>\n    cb := SizeOf(SUInfo);<br \/>\n    dwFlags := STARTF_USESHOWWINDOW;<br \/>\n    wShowWindow := WindowState;<br \/>\n  end;<\/p>\n<p>  Result := CreateProcess(nil, PChar(CmdLine), nil, nil, FALSE,<br \/>\n                          CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil,<br \/>\n                          PChar(ExtractFilePath(Filename)), SUInfo, ProcInfo);<\/p>\n<p>  \/\/Warten bis beendet<br \/>\n  if Result then<br \/>\n    WaitForSingleObject(ProcInfo.hProcess, INFINITE);<br \/>\nend;<br \/>\n[\/code]<\/p>\n<p>[tags]Delphi, Misc, Files[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8211; available WindowStates: SW_SHOWDEFAULT SW_SHOW SW_SHOWMINIMIZED SW_SHOWMAXIMIZED &#8230; look at Windows-API &#8212;&#8212;&#8212;&#8212; [code lang=&#8221;delphi&#8221;]function ExecAndWait(const Filename, Params: string; WindowState: word): boolean; var SUInfo:&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[75,112,107],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-32","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/188"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=188"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/188\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}