Hallo,
ich möchte folgenden Code verwenden, um zu testen, ob Microsoft Outlook gerade läuft oder nicht:
Delphi-Quellcode:
uses
ComObj,
ActiveX;
function IsObjectActive(ClassName:
string): Boolean;
var
ClassID: TCLSID;
Unknown: IUnknown;
begin
try
ClassID := ProgIDToClassID(ClassName);
Result := GetActiveObject(ClassID,
nil, Unknown) = S_OK;
except
// raise;
Result := False;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if IsObjectActive('
Word.Application')
then ShowMessage('
Word is running !');
if IsObjectActive('
Excel.Application')
then ShowMessage('
Excel is running !');
if IsObjectActive('
Outlook.Application')
then ShowMessage('
Outlook is running !');
if IsObjectActive('
Access.Application')
then ShowMessage('
Access is running !');
if IsObjectActive('
Powerpoint.Application')
then ShowMessage('
Powerpoint is running !');
end;
//Quelle: [url]http://www.swissdelphicenter.ch/torry/showcode.php?id=294[/url]
Kann man davon ausgehen, dass dies bei ALLEN Versionen von Outlook funktioniert?