Syntax

Parameters

hwnd

A handle to the window. This window must belong to the calling process.

hbmp

A handle to the bitmap to represent the window that hwnd specifies.

pptClient

The offset of a tab window's client region (the content area inside the client window frame) from the host window's frame. This offset enables the tab window's contents to be drawn correctly in a live preview when it is drawn without its frame.

dwSITFlags

The display options for the live preview. This parameter can be 0 or the following value.

DWM_SIT_DISPLAYFRAME (0x00000001)

0x00000001. Displays a frame around the provided bitmap.

Return Value

Returns S_OK if the function succeeds, or an error value otherwise. Note that because this bitmap is not cached, if the window is not being previewed when an application calls this function, the function returns a success code but the bitmap is discarded and not used.

Remarks

A live preview (also known as a Peek preview) of a window appears when a user moves the mouse pointer over the window's thumbnail in the taskbar or gives the thumbnail focus in the ALT+TAB window. This view is a full-sized view of the window and can be a snapshot or an iconic representation.

A window typically calls the DwmSetIconicLivePreviewBitmap function in response to a WM_DWMSENDICONICLIVEPREVIEWBITMAP message. The returned bitmap must not be larger than the client area of the window or frame and must have 32-bit color depth.

The Desktop Window Manager (DWM) uses a copy of the bitmap, but the caller retains ownership of the original bitmap and is responsible for freeing the resources that it uses when it is no longer needed. The DWM does not keep its copy of the bitmap when the DWM stops displaying the live preview representation.

Examples

To set a static, iconic bitmap to use as a live preview for the application's window, an application calls the DwmSetIconicLivePreviewBitmap function. To set this bitmap, the application must call DwmSetWindowAttribute to set window attributes for non-client rendering to DWMWA_FORCE_ICONIC_REPRESENTATION and DWMWA_HAS_ICONIC_BITMAP, as shown in the following code.