Windows 7 任务栏进度在一个应用程序中有效,但在另一应用程序中无效
我有两个不同的应用程序,都是用 C++Builder 2009 编写的本机应用程序,都是 MDI,并且都使用相同的进度条实用程序代码。其中之一可以正确更新 Windows 7 任务栏及其进度。另一个则不然。
我找不到这两个应用程序之间任何明显的差异。失败的应用程序中没有报告任何错误:对 ITaskbarList3::SetProgressValue
和 ITaskbarList3::SetProgressState
的调用返回 S_OK
,但在Windows 7 任务栏。
让 Windows 7 任务栏进度条正常工作有什么问题吗?我可能缺少任何要求吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的问题可能是 Delphi/C++Builder 特有的,并且是 VCL 处理其顶级窗口的方式不同造成的。
如果
Application.MainFormOnTaskBar
为 true,则仅当Application.MainFormHandle
用作 HWND 参数时,ITaskbarList3
才有效。如果
Application.MainFormOnTaskBar
为 false,则仅当Application.Handle
用作 HWND 参数时,ITaskbarList3
才有效。就我而言,一个项目的
MainFormOnTaskBar
为 true,而另一个项目的值为 false。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, thenITaskbarList3
only works ifApplication.MainFormHandle
is used as the HWND parameter.If
Application.MainFormOnTaskBar
is false, thenITaskbarList3
only works ifApplication.Handle
is used as the HWND parameter.In my case, one project had
MainFormOnTaskBar
true, and one had it false.我没有专门使用 Windows 7 进度条编写应用程序,但我编写了许多需要使用实时动画更新进度的 .Net 应用程序,根据我的经验,最大的问题是确保您在主线程上更新进度条。
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.