WinBatch® Technical Support Forum

Archived Boards => WinBatch Dynamic Dialogs => Topic started by: seckner on March 01, 2014, 06:18:49 AM

Title: Task Bar Icons
Post by: seckner on March 01, 2014, 06:18:49 AM
Wondering... In the Win XP days you could have a taskbar icon show progress by changing the text. It was nice when you didn't want a window up but  did want to show the program was running and doing things. Now, With Win 7 / 8 we can still have this program icon show but text labels, not so anymore. They do work if you put your mouse over it. So it got me wondering how Google or IE show download progress by showing the green background "progress bar" on the icon. Is this something that WinBatch can do? How?
Title: Re: Task Bar Icons
Post by: kdmoyers on March 03, 2014, 04:10:01 AM
Not really what you asked. but in case you don't find a way to make the progress bar, here's how to make the icon "flash".  I've used this successfully to communicate status.
-Kirby

Code (winbatch) Select
  #definefunction FlashWindowEx(title, count)
    ; automatically flash {title} window taskbar icon and window border.
    ; if {count} is positive, stops automatically after {count} flashes
    ; if {count} is zero, stop flashing now.
    ; if {count} is negative, stops automatically after {count} seconds
    ;
    if count < 0
      ; this is double the rate of window flashes for the FlashWindow call
      msBlinkRate = regqueryvalue(@REGCURRENT, "Control Panel\Desktop[CursorBlinkRate]")
      ; compute number of flashes
      count = int((0-count)*1000.0 / msBlinkRate / 2.0)
    endif
    winhan = DllHwnd(title)
    user32=StrCat(DirWindows(1),"User32.dll")
    @FLASHW_ALL = 3        ; Flash both the window caption and taskbar button
    @FLASHW_CAPTION = 1    ; Flash the window caption.
    @FLASHW_STOP = 0       ; Stop flashing. The system restores the window to its original state.
    @FLASHW_TIMER = 4      ; Flash continuously, until the FLASHW_STOP flag is set.
    @FLASHW_TIMERNOFG = 12 ; Flash continuously until the window comes to the foreground.
    @FLASHW_TRAY = 2       ; Flash the taskbar button.
    if count == 0
      dwFlags = @FLASHW_STOP
    else
      dwFlags = @FLASHW_TRAY ; @FLASHW_TRAY or @FLASHW_CAPTION or @FLASHW_ALL
    endif
    bFWI = binaryalloc(20)
    BinaryPoke4( bFWI,  0, 20)      ; cbSize (size of this struct)
    BinaryPoke4( bFWI,  4, winhan)  ; hwnd
    BinaryPoke4( bFWI,  8, dwFlags) ; dwFlags
    BinaryPoke4( bFWI, 12, count)   ; uCount (number of flashes to do)
    BinaryPoke4( bFWI, 16, 0)       ; dwTimeout (in ms, or zero for default blink rate)
    BinaryEODSet(bFWI, 20) 
    ret = DllCall(user32, long:"FlashWindowEx", lpbinary:bFWI)
    Binaryfree(bFWI)
    return ret != 0         ; ret true if window *was* active before call
  #endfunction
Title: Re: Task Bar Icons
Post by: seckner on March 03, 2014, 10:11:52 AM
Kirby - thank you, this will absolutely work!