public void Register(IntPtr destination, IntPtr source) { this._properties = new DWM_THUMBNAIL_PROPERTIES(); this._properties.dwFlags = DWM_TNP_CONSTANTS.DWM_TNP_VISIBLE + DWM_TNP_CONSTANTS.DWM_TNP_OPACITY + DWM_TNP_CONSTANTS.DWM_TNP_RECTDESTINATION + DWM_TNP_CONSTANTS.DWM_TNP_SOURCECLIENTAREAONLY; this._properties.opacity = 255; this._properties.fVisible = true; this._properties.fSourceClientAreaOnly = true; if (!this._windowManager.IsCompositionEnabled) { return; } try { this._handle = DwmApiNativeMethods.DwmRegisterThumbnail(destination, source); } catch (ArgumentException) { // This exception is raised if the source client is already closed // Can happen on a really slow CPU's that the window is still being // lised in the process list yet it already cannot be used as // a thumbnail source this._handle = IntPtr.Zero; } }
private void RegisterThumbnail() { this._thumbnailHandle = DwmApiNativeMethods.DwmRegisterThumbnail(this.Handle, this.Id); this._thumbnail = new DWM_THUMBNAIL_PROPERTIES(); this._thumbnail.dwFlags = DWM_TNP_CONSTANTS.DWM_TNP_VISIBLE + DWM_TNP_CONSTANTS.DWM_TNP_OPACITY + DWM_TNP_CONSTANTS.DWM_TNP_RECTDESTINATION + DWM_TNP_CONSTANTS.DWM_TNP_SOURCECLIENTAREAONLY; this._thumbnail.opacity = 255; this._thumbnail.fVisible = true; this._thumbnail.fSourceClientAreaOnly = true; this._isThumbnailSetUp = true; }