How do I show the Windows photo-printing wizard?

2019-05-11 02:46发布

问题:

I found the VB function ShowPhotoPrintingWizard:

CommonDialog.ShowPhotoPrintingWizard( _
  ByVal Files As VARIANT _
) As HRESULT

How do I call that or get equivalent functionality in Delphi? I'm using Delphi 2010.

回答1:

I think it might be this way for a single file:

uses
  ComObj;

procedure TForm1.Button1Click(Sender: TObject);
var
  CommDlg: OleVariant;
begin
  CommDlg := CreateOleObject('WIA.CommonDialog');
  CommDlg.ShowPhotoPrintingWizard('d:\Image.jpg');
end;

Or the similar for multiple files:

procedure TForm1.Button1Click(Sender: TObject);
var
  Files: OleVariant;
  CommDlg: OleVariant;
begin
  CommDlg := CreateOleObject('WIA.CommonDialog');
  Files := CreateOleObject('WIA.Vector');
  Files.Add('d:\Image 1.jpg');
  Files.Add('d:\Image 2.jpg');
  CommDlg.ShowPhotoPrintingWizard(Files);
end;


标签: delphi wia