Windows 7 taskbar progress works in one app but not another
I have two different applications, both native applications written in C++Builder 2009, both MDI, and both using the same progress bar utility code. One of them properly updates the Windows 7 taskbar with its progress. The other one doesn't.
I can't find any 开发者_高级运维obvious differences between the two applications. No errors are reported in the failing application: the calls to ITaskbarList3::SetProgressValue
and ITaskbarList3::SetProgressState
return S_OK
, but nothing happens in the Windows 7 taskbar.
Are there any gotchas in getting the Windows 7 taskbar progress bar to work? Any requirements that I might be missing?
My problem was likely specific to Delphi/C++Builder and was the result of a difference in how the VCL handles its top-level window.
If Application.MainFormOnTaskBar
is true, then ITaskbarList3
only works if Application.MainFormHandle
is used as the HWND parameter.
If Application.MainFormOnTaskBar
is false, then ITaskbarList3
only works if Application.Handle
is used as the HWND parameter.
In my case, one project had MainFormOnTaskBar
true, and one had it false.
I have not written an app using the Windows 7 progress bar specifically but I have written many .Net apps that require updating progress using a live animation and the biggest gotcha from my experience was being sure you were updating the progress bar on the main thread.
精彩评论