我有窗口,它用DWM缩略图镜像另一个窗口。现在我希望当用户调整预览窗口大小时,比调整预览区域大小。我怎样才能做到这一点?如何发送有关新预览大小的更新(将大小300x300更改为预览窗口的大小)?
switch (message) {
case WM_CREATE:
{
HRESULT hr = S_OK;
HTHUMBNAIL thumbnail = NULL;
hr = DwmRegisterThumbnail(hWnd, ieWindowHwnd, &thumbnail);
if (SUCCEEDED(hr)) {
// The destination rectangle size
RECT dest = {0,0,300,300};
// Set the thumbnail properties for use
DWM_THUMBNAIL_PROPERTIES dskThumbProps;
dskThumbProps.dwFlags = DWM_TNP_RECTDESTINATION | DWM_TNP_VISIBLE | DWM_TNP_SOURCECLIENTAREAONLY;
// Use the window frame and client area
dskThumbProps.fSourceClientAreaOnly = FALSE;
dskThumbProps.fVisible = TRUE;
dskThumbProps.rcDestination = dest;
// Display the thumbnail
hr = DwmUpdateThumbnailProperties(thumbnail, &dskThumbProps);
}
}
break;
case WM_SIZE:
{
// What to do here.
}
break;