10

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?

0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
Josh Kelley
  • 56,064
  • 19
  • 146
  • 246
  • Are they running on the same machine? You don't mention that. If not, does one machine use small icons for the taskbar and the other large? You only get overlays (including progress bars) with large icons. – Kate Gregory Feb 25 '11 at 16:05
  • @Kate: Yes, they're running on the same machine and are both using large taskbar icons. – Josh Kelley Feb 25 '11 at 17:35
  • Is this utility code placed in the same part of both your applications or are there any (even the slightest) differences? Since you mentioned that both applications are MDI, try tracing the path that windows messages for progress update have to go in both cases. I'm guessing that in case of application that doesn't work as intended, progress update messages are not getting to the main (application) message loop. This is, however, just a guess, since I don't have practical experience with this functionality. – LightBulb May 17 '12 at 01:09

2 Answers2

1

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.

Josh Kelley
  • 56,064
  • 19
  • 146
  • 246
-1

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.

Roger
  • 302
  • 1
  • 8