Tuesday, February 22, 2005

IThumbnailCapture and Delphi

From a request in borland.public.delphi.nativeapi.win32 , I found that the IThumbnailCapture interface wasn't very well documented - or rather, what wasn't was how to create an instance that supported such an interface. So I spent some time making a demo, modifying the CoolStuf demo that comes with Delphi. (In the Demos\CoolStuf folder).

The actual translation of the interface is :


const
IID_IThumbnailCapture : TGUID = (
D1:$4ea39266; D2:$7211; D3:$409f;
D4:($b6,$22,$f6,$3d,$bd,$16,$c5,$33));
type
SIZE = record
cx, cy : LongInt;
end;
PSIZE = ^SIZE;

IThumbnailCapture = interface( IUnknown )
['{4ea39266-7211-409f-b622-f63dbd16c533}']
// *** IThumbnailCapture methods ***
function CaptureThumbnail( pMaxSize : PSIZE;
pHTMLDoc2 : IUnknown;
var phbmThumbnail : HBiTMAP ) : HResult;
stdcall;


and the way to create an instance is:


CoCreateInstance(ClassID, nil,
CLSCTX_INPROC_SERVER or
CLSCTX_LOCAL_SERVER,
IThumbnailCapture, Capture);


Hope this helps. Download the code.

0 Comments:

Post a Comment

<< Home