Du könntest mit folgender function prüfen ob outlook.exe läuft, und wenn nicht dann outlook starten :
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
| uses .....Tlhelp32.... ..... function IsRunning(ExeFileName: string): Boolean; var ContinueLoop: BOOL; FSnapshotHandle: THandle; FProcessEntry32: TProcessEntry32; begin result := False; FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); FProcessEntry32.dwSize := Sizeof(FProcessEntry32); ContinueLoop := Process32First(FSnapshotHandle,FProcessEntry32); while integer(ContinueLoop) <> 0 do begin if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeFileName))) then Result := True; ContinueLoop := Process32Next(FSnapshotHandle,FProcessEntry32); end; CloseHandle(FSnapshotHandle); end; |
der programmcode würde dann in etwa so aussehen :
Delphi-Quelltext
1: 2: 3: 4:
| uses ......ShellAPI..... if not IsRunning('outlook.exe') then ShellExecute(0, 'open', 'outlook.exe', '', '', SW_SHOW); |
Das Ganze in einen Timer und das wars !!
Man sollte keine Dummheit zweimal begehen, die Auswahl ist schließlich groß genug.