Autor Beitrag
Maisinator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167

Win XP HE SP3, Win Vista HP SP2
Delphi ;-)
BeitragVerfasst: Sa 19.09.09 17:22 
hallo,

wie kann ich bei einem programm, welches ich mit schellexecute ausführe, den status anzeigen? vlt. mit statusbar usw...???

THX

_________________
Das Unmögliche wagen, um das Mögliche möglich zu machen...
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Sa 19.09.09 17:38 
Was für einen "Status" meinst du..?

_________________
PROGRAMMER: A device for converting coffee into software.
Maisinator Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167

Win XP HE SP3, Win Vista HP SP2
Delphi ;-)
BeitragVerfasst: Sa 19.09.09 18:14 
ich mein, wenn man ein programm mit shellexecute öffnet, was ein bisschen größer ist (so 20 mb) dauert es ja immer ein bisschen, bis das programm geladen wurde, diesen zeitraum mein ich mit status. also etwas ähnliches, wie z.b. das windows kopierfenster, mit dem statusbalken oder einfach eine prozentzahl, die ansteigt...

_________________
Das Unmögliche wagen, um das Mögliche möglich zu machen...
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Sa 19.09.09 19:11 
*grübel* so ein Thema hatten wir doch vor Kurzem erst.
Und dabei sind wir zu dem Ergebnis gekommen, dass man NICHT rausfinden kann, wann ein Programm "fertig" gestartet ist - da man eben nicht weiß, was das Programm zur Initialisierung noch alles macht.

_________________
PROGRAMMER: A device for converting coffee into software.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19326
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 19.09.09 19:15 
Man kann das ohne Rückmeldung von dem Programm nicht als Fortschritt anzeigen, aber bei den meisten Programmen kann man durchaus erkennen, wenn die fertig geladen sind.
Dazu gibts auch was in der Library.

// EDIT:
Doch nicht in der Library, aber im Forum: :mrgreen:
www.delphi-forum.de/....php?p=460553#460553
Tryer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 226
Erhaltene Danke: 7



BeitragVerfasst: Sa 19.09.09 19:34 
Eine Lösung mit ShellExecuteEx() und WaitForInputIdle() ist auch denkbar.
Ein "Prozentwert" ist nur denkbar wenn man das Startverhalten der Anwendung genau kennt, dann kann man z.B. die Anzahl der erzeugten Threads/Handle und den Speicherverbrauch auswerten. Weder leicht noch sehr präzise. WaitForInputIdle oder die Funktion welche Jaenicke genannt hat erlauben es aber zumindest eine Sanduhr anzuzeigen o.ä.

Grüsse, Dirk
Maisinator Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167

Win XP HE SP3, Win Vista HP SP2
Delphi ;-)
BeitragVerfasst: Sa 19.09.09 20:29 
ok, danke. wie würde das denn mit WaitForInputIdle() aussehen?

_________________
Das Unmögliche wagen, um das Mögliche möglich zu machen...
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19326
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 19.09.09 20:33 
Da wären wir wieder bei deinem Lieblingsthema, der englischen Doku: :mrgreen:
msdn.microsoft.com/e...ibrary/ms687022.aspx
Maisinator Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167

Win XP HE SP3, Win Vista HP SP2
Delphi ;-)
BeitragVerfasst: Sa 19.09.09 21:40 
mmh ja, im gegensatz zu shellexecute versteh ich diesmal nur bahnhof :cry:
kann mir das vlt. jemand erklären?? bitte...

_________________
Das Unmögliche wagen, um das Mögliche möglich zu machen...
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19326
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 19.09.09 21:42 
Na gut, bin ja nicht so, hier ein Auszug aus meinem Updater Projekt: ;-)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
procedure ExecuteNewInstance(AExplicitAdmin, AWait: Boolean; AWindow: THandle;
  AParams: string);
var
  ExecuteInfo: SHELLEXECUTEINFO;
begin
  ExecuteInfo.cbSize := sizeof(SHELLEXECUTEINFO);
  ExecuteInfo.Wnd := AWindow;
  ExecuteInfo.fMask := SEE_MASK_NOCLOSEPROCESS;
  if AExplicitAdmin then
    ExecuteInfo.lpVerb := 'runas'
  else
    ExecuteInfo.lpVerb := 'open';
  ExecuteInfo.lpFile := PChar(ParamStr(0));
  ExecuteInfo.lpParameters := PChar(AParams);
  ExecuteInfo.lpDirectory := PChar(ExtractFilePath(ParamStr(0)));
  ExecuteInfo.nShow := SW_SHOWNORMAL;

  { TODO 5 -oSebastian -cWindows 9x Support : When executing ShellExecuteEx Windows 98 and ME fire an exception }
  if ShellExecuteEx(@ExecuteInfo) then
    try
      if AWait then
        WaitForSingleObject(ExecuteInfo.hProcess, INFINITE);
    finally
      CloseHandle(ExecuteInfo.hProcess);
    end;
end;
Da muss stattdessen halt nur WaitForInputIdle hin. Und lpFile muss den richtigen Dateinamen statt der eigenen Exe bekommen (wie ich es brauchte). ;-)