Flashing item of window minimized in taskbar [1/2 Resolved]

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Flashing item of window minimized in taskbar [1/2 Resolved]

Post by Kwai chang caine »

Hello at all

I search to flashing the item of the windows in the taskbar, but when the windows is minimized

I have try several code, someone works if windows is visible, but nothing works in minimized position :cry:
http://www.purebasic.fr/english/viewtop ... c7#p341755
http://www.purebasic.fr/english/viewtop ... 725#p85725
http://forums.purebasic.com/english/vie ... bd#p335735

If someone have another idea
Have a good day
Last edited by Kwai chang caine on Mon Jul 06, 2015 5:13 pm, edited 1 time in total.
ImageThe happiness is a road...
Not a destination
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Flashing item of window minimized in taskbar

Post by Marc56us »

Hi KCC,

A simple alternative: flash the text :wink:

Code: Select all

OpenWindow(0, 0, 0, 640, 480, "Zzzzz...", #PB_Window_SystemMenu | #PB_Window_Minimize)

AddWindowTimer(0, 1, 3000)

Repeat
    Event = WaitWindowEvent(50)
    Select Event
        Case #PB_Event_CloseWindow
            End
        Case #PB_Event_Timer
            For i = 1 To 10
                SetWindowTitle(0, "Hey! I'm here.")            
                Delay(500)
                SetWindowTitle(0, "")
                Delay(500)
            Next
            SetWindowTitle(0, "No one ? Bye!")
            Delay(3000)
            End
    EndSelect
ForEver
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Flashing item of window minimized in taskbar

Post by Kwai chang caine »

Hello Marc56Us glad to talk to you :wink:

Yeaaaah !!! it's a good idea !!! :D

Sometime the things most simple is not more simple to found for KCC :mrgreen:

If nobody have a better solution to Flashing the item minimized, i use your splendid idea :idea:

Thanks a lot, and have a good and very hot hot night :wink:
ImageThe happiness is a road...
Not a destination
uweb
User
User
Posts: 98
Joined: Wed Mar 15, 2006 9:40 am
Location: Germany

Re: Flashing item of window minimized in taskbar [1/2 Resolv

Post by uweb »

I have only tested one of your own Links -http://www.purebasic.fr/english/viewtopic.php?p=341755
For me it works fine after remove the definition of Structure FLASHWINFO.

The Code above works here, but i see nothing unless the mouse is over the item.
Tested on Windows 8.1 64 Bit.

Not realy flashing, but dependent on what you want to communicate, may also good :
http://www.purebasic.fr/english/viewtop ... 12&t=55221
Please pardon my English, my native tongue is German.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Flashing item of window minimized in taskbar [1/2 Resolv

Post by Danilo »

Using luis' code base:

Code: Select all

;
; based on ITaskbarList3 code by luis:
; http://www.purebasic.fr/english/viewtopic.php?f=13&t=49356&start=5&hilit=ITaskbarList3
;
EnableExplicit

; http://msdn.microsoft.com/en-us/library/windows/desktop/dd391692%28v=vs.85%29.aspx

Interface ITaskbarList3 Extends ITaskbarList2
 SetProgressValue.i (hWnd.i,ullCompleted.q,ullTotal.q)
 SetProgressState.i (hWnd.i,tbpFlags.l)
 RegisterTab.i (hWndTab.i,hWndMDI.i)
 UnregisterTab.i (hWndTab.i)
 SetTabOrder.i (hWndTab.i,hWndInsertBefore.i)
 SetTabActive.i (hWndTab.i,hWndMDI.i,tbatFlags.l)
 ThumbBarAddButtons.i (hWnd.i,cButtons.l,*pButton)
 ThumbBarUpdateButtons.i (hWnd.i,cButtons.l,*pButton)
 ThumbBarSetImageList.i (hWnd.i,himl.i)
 SetOverlayIcon.i (hWnd.i,hIcon.i,pszDescription$)
 SetThumbnailTooltip.i (hWnd.i,pszTip$)
 SetThumbnailClip.i (hWnd.i,*prcClip)
EndInterface

Interface ITaskbarList4 Extends ITaskbarList3
 SetTabProperties.i (hwndTab.i,stpFlags.l)
EndInterface

DataSection
 CLSID_TaskBarList:
  Data.l $56FDF344
  Data.w $FD6D, $11D0
  Data.b $95, $8A, $00, $60, $97, $C9, $A0, $90
 IID_ITaskBarList3:
  Data.l $EA1AFB91
  Data.w $9E28,$4B86
  Data.b $90,$E9,$9E,$9F,$8A,$5E,$EF,$AF
EndDataSection

#TBPF_NOPROGRESS    = $0
#TBPF_INDETERMINATE = $1
#TBPF_NORMAL        = $2
#TBPF_ERROR         = $4
#TBPF_PAUSED        = $8

#CLSCTX_INPROC_SERVER            = $1
#CLSCTX_INPROC_HANDLER           = $2
#CLSCTX_LOCAL_SERVER             = $4
#CLSCTX_INPROC_SERVER16          = $8
#CLSCTX_REMOTE_SERVER            = $10
#CLSCTX_INPROC_HANDLER16         = $20
#CLSCTX_RESERVED1                = $40
#CLSCTX_RESERVED2                = $80
#CLSCTX_RESERVED3                = $100
#CLSCTX_RESERVED4                = $200
#CLSCTX_NO_CODE_DOWNLOAD         = $400
#CLSCTX_RESERVED5                = $800
#CLSCTX_NO_CUSTOM_MARSHAL        = $1000
#CLSCTX_ENABLE_CODE_DOWNLOAD     = $2000
#CLSCTX_NO_FAILURE_LOG           = $4000
#CLSCTX_DISABLE_AAA              = $8000
#CLSCTX_ENABLE_AAA               = $10000
#CLSCTX_FROM_DEFAULT_CONTEXT     = $20000
#CLSCTX_ACTIVATE_32_BIT_SERVER   = $40000
#CLSCTX_ACTIVATE_64_BIT_SERVER   = $80000
#CLSCTX_ENABLE_CLOAKING          = $100000
#CLSCTX_PS_DLL                   = $80000000

Procedure.i Create_TaskbarList3()
 Protected *tl3.ITaskbarList3
 CoInitialize_(#Null)
 CoCreateInstance_ (?CLSID_TaskBarList,#Null,#CLSCTX_INPROC_SERVER,?IID_ITaskBarList3,@*tl3)
 ProcedureReturn *tl3
EndProcedure

Procedure.i Destroy_TaskbarList3 (*tl3.ITaskbarList3)
 If *tl3
    *tl3\Release()
 EndIf
 CoUninitialize_()
EndProcedure

Enumeration
 #WIN_MAIN
EndEnumeration

Procedure Main()
 Protected iEvent, pct, rec.RECT
 Protected *tl3.ITaskbarList3
 
 If OpenWindow(#WIN_MAIN, 0, 0, 300, 150, "My Window", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
   
    *tl3 = Create_TaskbarList3()
    *tl3\HrInit()
    ;*tl3\SetProgressValue(WindowID(#WIN_MAIN),0,100)
    ;*tl3\SetProgressState(WindowID(#WIN_MAIN), #TBPF_INDETERMINATE)
 
    Repeat
        Select WaitWindowEvent()
            Case #PB_Event_RestoreWindow
                *tl3\SetProgressState(WindowID(#WIN_MAIN), #TBPF_NOPROGRESS)
            Case #PB_Event_MinimizeWindow
                *tl3\SetProgressState(WindowID(#WIN_MAIN), #TBPF_INDETERMINATE)
            Case #PB_Event_CloseWindow
                Break
        EndSelect
    ForEver
   
 EndIf
 
 Destroy_TaskbarList3 (*tl3)
 
EndProcedure


Main()
Win7+ only, and proper use would be for showing state (processing something), not notifications. ;)

Highlighting, instead flashing:

Code: Select all

            Case #PB_Event_MinimizeWindow
                *tl3\SetProgressValue(WindowID(#WIN_MAIN),100,100)
                *tl3\SetProgressState(WindowID(#WIN_MAIN), #TBPF_PAUSED)
(Flashing could probably done by using a timer)
Lite
User
User
Posts: 17
Joined: Fri Dec 21, 2012 7:50 am

Re: Flashing item of window minimized in taskbar [1/2 Resolv

Post by Lite »

Hello

A example with winapi.

Code: Select all

hwnd = OpenWindow(0,0,0,200,200,"Flash Window",#PB_Window_ScreenCentered|#PB_Window_SystemMenu) 

Info.FLASHWINFO 
Info\cbSize = SizeOf(FLASHWINFO) 
Info\hwnd   = hwnd 
Info\dwFlags= $7;#FLASHW_ALL 
Info\uCount = 0 
Info\dwTimeout = 300 
FlashWindowEx_(Info) 

Repeat : Until WindowEvent() = #PB_Event_CloseWindow 
Greetings
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Flashing item of window minimized in taskbar [1/2 Resolv

Post by Kwai chang caine »

Thanks at you all for your precious help 8)

@UWEB
You have right, i have tested the code under XP and that works, but with W7 not :shock:
I try another time tomorrow in my enterprise with W7

@Danilo
I test tomorrow in my enterprise with W7 because here i have XP and i have a memory error, normal you already say that to me :wink:

@Lite
This code works too on XP, i test another time tomorrow in my enterprise with W7

@All
Again thanks, good night and at tommorrow :wink:
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Flashing item of window minimized in taskbar [1/2 Resolv

Post by Kwai chang caine »

@Lite
I confirm...this code works on XP Basic theme but not works on W7 with basic theme :|

Code: Select all

hwnd = OpenWindow(0,0,0,200,200,"Flash Window",#PB_Window_ScreenCentered|#PB_Window_Minimize|#PB_Window_SystemMenu) 

Info.FLASHWINFO 
Info\cbSize = SizeOf(FLASHWINFO) 
Info\hwnd   = hwnd 
Info\dwFlags= $7;#FLASHW_ALL 
Info\uCount = 0 
Info\dwTimeout = 300 
FlashWindowEx_(Info) 

Repeat : Until WindowEvent() = #PB_Event_CloseWindow 
@UWEB
The Code above works here, but i see nothing unless the mouse is over the item.
Same problem :wink:

@DANILO
ATTENTION i use the basic theme of W7 (The W95 Style... l love the simplicity :mrgreen:)
Nothing, in the Restore or Minimize position :|
I have activate this two lines too, and always nothing

Code: Select all

 *tl3\SetProgressValue(WindowID(#WIN_MAIN),0,100)
    *tl3\SetProgressState(WindowID(#WIN_MAIN), #TBPF_INDETERMINATE)
@Marc256US
For the moment i use your tips :wink:
But in the aero theme of W7 they are not text in the taskbar, just icons :twisted:

@All
Thanks when even at you all for your try and answer 8)
ImageThe happiness is a road...
Not a destination
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Flashing item of window minimized in taskbar [1/2 Resolv

Post by Marc56us »

Another simple way: Blink a systrayico.
No api, only basic, Purebasic :)

Code: Select all

; FlashSysTray
; Marc56us - 20150707
; small example - Purebasic 5.31 (Windows)
; Blink a systrayico to attract attention
; (works in a thread to free cpu time)

EnableExplicit

Enumeration 
    #SysTraIcon
    #Img_1
    #Img_2
EndEnumeration

Global Done = 0

Procedure Blink_SysTray(*Nb_blink)
    Protected i
    For i = 1 To *Nb_Blink
        ChangeSysTrayIcon(#SysTraIcon, ImageID(#Img_2))
        Delay(100)
        ChangeSysTrayIcon(#SysTraIcon, ImageID(#Img_1))
        Delay(100)
    Next
    Done = 1
EndProcedure

OpenWindow(0, 0, 0, 640, 480, "Zzzzz...", #PB_Window_SystemMenu | #PB_Window_Minimize)

CreateImage(#Img_1, 16, 16, 24, $FFFFFF)
CreateImage(#Img_2, 16, 16, 24, $0000FF)
AddSysTrayIcon(#SysTraIcon, WindowID(0), ImageID(#Img_1))

AddWindowTimer(0, 1, 3000)

Define Event
Define Blink

Repeat
    Event = WaitWindowEvent(50)
    Select Event
        Case #PB_Event_CloseWindow
            End
        Case #PB_Event_Timer
            If Not Done
                Blink = CreateThread(@Blink_SysTray(), 15)
            EndIf
    EndSelect
ForEver
You can add a beep in thread to add more attention.

I use thread (this is for the first time for me :o ) so user can do anything else at the same time.
:wink:
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Flashing item of window minimized in taskbar [1/2 Resolv

Post by Kwai chang caine »

Yeees !!! i have thinking to this option too :wink:

But i don't know why, i believe it's not also visible :oops:
With your example, i'm forced to take sun glasses...so i add your second example to your first...like that or the user see the message or he sleep :mrgreen:

I have also thinking to hide window, like this the item disappears.
It's really visible, but the problem is the orders of items in the taskbar change
Because the item of our windows is always the last when he is a new time visible, even if for exampler it is at the one, two, etc.. position :cry:

Code: Select all

Global Quit

Procedure MakeAMessIntoTaskBar(*Value)
 
 Repeat
  
  Delay(500)
  
  If IsWindowVisible_(WindowID(0))
   HideWindow(0, #True)
  Else
   HideWindow(0, #False)
  EndIf
  
  If Quit Or Not IsIconic_(WindowID(0))
   HideWindow(0, #False)
   Break
  EndIf 
 
 ForEver
   
EndProcedure

OpenWindow(0, 0, 0, 640, 480, "Always Zzzzz...", #PB_Window_SystemMenu|#PB_Window_Minimize)
CreateThread(@MakeAMessIntoTaskBar(), 0)

Repeat

 Event = WaitWindowEvent(50)

 Select Event
 
  Case #PB_Event_CloseWindow
   
   Quit = #True
   End
      
 EndSelect
 
ForEver
ImageThe happiness is a road...
Not a destination
Julian
Enthusiast
Enthusiast
Posts: 276
Joined: Tue May 24, 2011 1:36 pm

Re: Flashing item of window minimized in taskbar [1/2 Resolv

Post by Julian »

I've been watching this thread for a while and wondering why I've not been able to get the examples to work.

Lite posted the following code earlier (I've changed it to 10 flashes):

Code: Select all

hwnd = OpenWindow(0,0,0,200,200,"Flash Window",#PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_NoActivate) 

Info.FLASHWINFO 
Info\cbSize = SizeOf(FLASHWINFO) 
Info\hwnd   = hwnd 
Info\dwFlags= $7;#FLASHW_ALL 
Info\uCount = 10
Info\dwTimeout = 300 
FlashWindowEx_(Info) 

Repeat : Until WindowEvent() = #PB_Event_CloseWindow 
I managed to get it to work in 5.31(x86) but not in 5.31(x64), could anyone shed some light onto why it wont work in 64bit? It literally does the same thing, opens the window, but doesn't flash 10 times.

Thanks in advance.
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Flashing item of window minimized in taskbar [1/2 Resolv

Post by Thunder93 »

Once more, a situation where you'll need to use your own structure.

Code: Select all

Structure FLASHWINFO_B Align #PB_Structure_AlignC
  cbSize.l
  hwnd.i
  dwFlags.l
  uCount.l
  dwTimeout.l
EndStructure
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Julian
Enthusiast
Enthusiast
Posts: 276
Joined: Tue May 24, 2011 1:36 pm

Re: Flashing item of window minimized in taskbar [1/2 Resolv

Post by Julian »

Thanks Thunder93, its working in x86 and x64 now

Code: Select all

Structure FLASHWINFO_B Align #PB_Structure_AlignC
  cbSize.l
  hwnd.i
  dwFlags.l
  uCount.l
  dwTimeout.l
EndStructure

hwnd = OpenWindow(0,0,0,200,200,"Flash Window",#PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_NoActivate) 

Info.FLASHWINFO_B 
Info\cbSize = SizeOf(FLASHWINFO_B) 
Info\hwnd   = hwnd 
Info\dwFlags= $7;#FLASHW_ALL 
Info\uCount = 10
Info\dwTimeout = 300 
FlashWindowEx_(Info) 

Repeat : Until WindowEvent() = #PB_Event_CloseWindow
Post Reply