How to Properly Use and Instantiate existing Preview Handlers
See the question and my original answer on StackOverflowYou just need to add a SetRect call after initialization:
RECT rect;
GetClientRect(window, &rect);
iPreviewHandler->SetWindow(window, &rect);
iPreviewHandler->DoPreview();
// add this
iPreviewHandler->SetRect(&rect);