Question

By design, the toolbar application thumbnail on Vista does not update when an application is minimized, since the minimized window itself is not redrawing. For a monitoring application I have, it would be useful to update the application thumbnail while the application remains minimized. I am using Delphi 2009. Can anyone suggest a good workaround for this?

HMcG

Was it helpful?

Solution

That's an interesting one I guess it is possible in some way with the windows API, i'm not on a vista machine at the moment but I think Windows Media Player still shows the video playing when minimized.

I suppose a hack would be to override the minimize button and move the form off screen, then detect the form becoming active again and moving it back to the old location. This would mean the form is out of view but not minimized.

OTHER TIPS

I found something in a Microsoft development forum that addresses this topic. The question was about a way to provide a custom thumbnail image, to which Microsoft's Leonardo Blanco responded with this:

We do no[t] plan to provide a means for an app to create a custom alternative thumbnail representation, but we will provide an API to opt out of the normal thumbnail image altogether ....

It looks like those plans might have changed in the meantime, judging from the existence in MSDN of the functions DwmSetIconicLivePreviewBitmap and DwmSetIconicThumbnail for Windows 7. Right now those entries don't really contain any explanations, but their names look promising.

Someone pointed out that the thumbnail for Windows Media Player shows moving video even while the window is minimized. Blanco's explanation:

WMP uses a new video pipeline that talks directly to the [Desktop Window Manager] to achieve a smoother playback experience. This pipeline relies on [DirectX] and doesn't depend on window visibility information, so the thumbnail can be kept alive even though the window is minimized, as long as the app continues to submit frames. You may notice, however, that the UI around the video isn't live anymore (this is tricky to observe because the UI around the video doesn't usually update). For a bit more info on this method, see the DwmSetPresentParameters API.

I'm afraid I can't find anything more about this. Documentation for DWM functions is sparse.

Given the nature of your application, maybe it's worth considering a gadget to live on the Windows Sidebar.

I don't know if this workaround still works in Delphi 2009: override CreateParams to set GetDesktopWindow as the WndParent.

I have changed Application.Title in the past to show some information in the taskbar button. I dont suppose this causes a redraw of the icon?

In Delphi 2007 your main form is on the task bar if you set

  Application.MainFormOnTaskbar := True;

To keep it updating then you need to prevent your application from minimizing and instead just move it to the back. You can do this by putting a TApplicationEvents on the form and assigning an event handler to the OnMinimize event and then call Application.Restore in there. You will want to track your own minimization state and make sure you hide all the other forms (if you have them) and only have your main form visible, but at the lowest Z-order when it is "minimized."

I don't think Windows Vista lets you move forms off the screen, or you could just do that. Maybe there is a hack around that.

Good luck!

go to your source project and change Application.MainFormOnTaskbar to false: Application.MainFormOnTaskbar := false;

Regards, Mauricio

http://sourceforge.net/projects/tcycomponents/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top