TaskBar ICON Dynamic Changes

Started by Mark Strickland, January 26, 2006, 05:32:55 PM

Previous topic - Next topic

Mark Strickland

Is there an "easy" way to update the TaskBar (not tray) Icon of a running program with new text?

If a program is going to run for a while and it is minimized it would be nice to update the TaskBar.  It defaults to the form caption but changing that does NOT change the TaskBar.

I looked on the PB forum but I did not see much.

Thanks.

TechSupport

I tried the following simple test and the taskbar updated. Create a new, blank project with one form. Add a CommandButton. Add the following code:

Function FORM1_COMMAND1_BN_CLICKED ( _
                                  ControlIndex     As Long,  _  ' index in Control Array
                                  hWndForm         As Dword, _  ' handle of Form
                                  hWndControl      As Dword, _  ' handle of Control
                                  idButtonControl  As Long   _  ' identifier of button
                                  ) As Long

 
  Local p As Long
 
  ShowWindow HWND_FORM1, %SW_MINIMIZE
 
  p = 1
  Do
     
      ' Update the caption with new text
      FF_Control_SetText HWND_FORM1, "Caption" & Str$(p)
      FF_DoEvents                      
     
      Sleep 1000

      Incr p
  Loop Until p = 5
 
End Function

Mark Strickland

Paul,

Thanks for the reply but that is EXACTLY what I tried and it did not work.

Here is why ---

In my intial testing I was delaying only 50 ms and counting to 100.  The tool tip on the TaskBar button did show my new updating caption even though the button caption did not change.  The duration of the test was about 10 total seconds so the button had plenty of time to update.

I changed the delay to 100 ms and it worked as the counter incremented.

I guess Windows is trying to help and not spend too much time updating the TaskBar caption.

In my application I will just have to be aware of updating too much.  I may put the update in a timer to do it every second or two since "real time" is not necessary.

Roger Garstang

Isn't the taskbar just a toolbar that could be sent an update/redraw command?  I miss the good ole Win 3.x days when the minimized icons could actually be drawn on.  I have an old Asteroids game that when minimized could be played in the icon that minimized to the desktop behind Progman.

TechSupport

I guess that when a program is minimized it gets a pretty low priority in the Windows messaging system. If you have other programs running in the foreground then maybe those programs are stealing more CPU time relagating the minimized application to only get the messages occassionally.