3

您好我使用的是Delphi 2010 + Windows XP,您可以在Delphi 的Windows XP 中调用照片打印向导。

如何显示 Windows 照片打印向导?

以上提示仅适用于 Windows 7

谢谢你。

4

1 回答 1

6

MSDN包括示例代码:

static const CLSID CLSID_PrintPhotosDropTarget = 
  {0x60fd46de, 0xf830, 0x4894, {0xa6, 0x28, 0x6f, 0xa8, 0x1b, 0xc0, 0x19, 0x0d}};

// A data object that contains the list of photos to print.
IDataObject* pDataObject;

// Create the Photo Printing Wizard drop target.
CComPtr<IDropTarget> spDropTarget;

hr = CoCreateInstance(CLSID_PrintPhotosDropTarget,
                      NULL,
                      CLSCTX_INPROC_SERVER,
                      IID_PPV_ARGS(&spDropTarget));

// Drop the data object onto the drop target.
POINTL pt = {0};
DWORD dwEffect = DROPEFFECT_LINK | DROPEFFECT_MOVE | DROPEFFECT_COPY;

spDropTarget->DragEnter(pDataObject, MK_LBUTTON, pt, &dwEffect);

spDropTarget->Drop(pDataObject, MK_LBUTTON, pt, &dwEffect);

Delphi 代码是这样的:

uses
  ActiveX, ComObj;

const
  CLSID_PrintPhotosDropTarget: TGUID = '{60FD46DE-F830-4894-A628-6FA81BC0190D}';

procedure InvokePhotoPrintingWizard;
var
  Effect: LongInt;
  Position: TPoint;
  DataObject: IDataObject;
  DropTarget: IDropTarget;
begin
  // create the Photo Printing Wizard drop target
  OleCheck(CoCreateInstance(CLSID_PrintPhotosDropTarget, nil,
    CLSCTX_INPROC_SERVER, IDropTarget, DropTarget));
  // drop the data object onto the drop target
  Position.X := 0;
  Position.Y := 0;
  Effect := DROPEFFECT_LINK or DROPEFFECT_MOVE or DROPEFFECT_COPY;
  OleCheck(DropTarget.DragEnter(DataObject, MK_LBUTTON, Position, Effect));
  OleCheck(DropTarget.Drop(DataObject, MK_LBUTTON, Position, Effect));
end;
于 2013-03-26T22:27:51.483 回答