IPreviewHandler SetWindow does not specify a size

203 views Asked by At

I want to add a preview on my window. A rectangle is passed into the function in which the preview will be drawn, but for some reason the preview is drawn in the entire window and not in the specified rectangle.

RECT rectPreview;
rectPreview.top=10;
rectPreview.left=10;
rectPreview.right=100;
rectPreview.bottom=100;

IPreviewHandler *pIPreviewHandler(NULL) ;
CoCreateInstance( cls, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IID_IPreviewHandler, (LPVOID*)&pIPreviewHandler );
//some code
pIPreviewHandler->SetWindow( hWnd , &rectPreview );
pIPreviewHandler->SetRect( &rectPreview );
pIPreviewHandler->DoPreview( );

How to set the drawing rectangle so that the preview is only in it?

1

There are 1 answers

0
Hurr On BEST ANSWER

just need to call SetRect after DoPreview

pIPreviewHandler->DoPreview();
pIPreviewHandler->SetRect( &rectPreview );