2010. július 22., csütörtök

How to use the Photoshop COM interface with Delphi


Problem/Question/Abstract:

How to use the Photoshop COM interface with Delphi

Answer:

uses
  ComObj, ActiveX, PhotoShopTypeLibrary_TLB;

var
  PS: IPhotoShopApplication;
  Unknown: IUnknown;
begin
  Result := GetActiveObject(CLASS_PhotoshopApplication, nil, Unknown);
  if (Result = MK_E_UNAVAILABLE) then
    PS := CoPhotoshopApplication.Create
  else
  begin
    { make sure no other error occurred }
    OleCheck(Result);
    OleCheck(Unknown.QueryInterface(IPhotoShopApplication, PS));
  end;
  PS.Visible := True;
end;

Nincsenek megjegyzések:

Megjegyzés küldése