Windows 7 taskbar button progress bar
- AlexSchaft
- Posts: 172
- Joined: Fri Oct 07, 2005 1:29 pm
- Location: Edenvale, Gauteng, South Africa
Windows 7 taskbar button progress bar
Hi,
I'm trying to show progress on the windows taskbar via the api from http://msdn.microsoft.com/en-us/library ... 85%29.aspx but can't seem to get it to work.
Has anyone else done this?
Alex
I'm trying to show progress on the windows taskbar via the api from http://msdn.microsoft.com/en-us/library ... 85%29.aspx but can't seem to get it to work.
Has anyone else done this?
Alex
- AlexSchaft
- Posts: 172
- Joined: Fri Oct 07, 2005 1:29 pm
- Location: Edenvale, Gauteng, South Africa
Re: Windows 7 taskbar button progress bar
Just a bump on this in case anyone has done this by now.
Re: Windows 7 taskbar button progress bar
Hello,
I resurrect this thread to share a FiveWin support for progress bar in task bar:
Here a test program with C code for slider support, I compiled it with Harbour 3.2, FWH 15.03 and Visual Studio compiler.
Maybe It can be include in the next FiveWin release
Regards,
Antonino
I resurrect this thread to share a FiveWin support for progress bar in task bar:
Code: Select all
#include <fivewin.ch>
#include <slider.ch>
function main()
LOCAL oDlg, oBru, nSlider := 40
DEFINE WINDOW oDlg FROM 0,0 TO 500,400 PIXEL TITLE "Test" BRUSH oBru
@ 8,8 BUTTON "RESET" SIZE 80,36 PIXEL ACTION TBL_RESET(oDlg:hWnd)
@ 48,8 BUTTON "PROCESSING" SIZE 80,36 PIXEL ACTION TBL_PROCESSING(oDlg:hWnd)
@ 88,8 BUTTON "PROGRESS" SIZE 80,36 PIXEL ACTION (TBL_SETPROGRESS(oDlg:hWnd), TBL_SETVALUE(oDlg:hWnd, nSlider, 100))
@ 128,8 BUTTON "ERROR" SIZE 80,36 PIXEL ACTION TBL_SETERROR(oDlg:hWnd)
@ 168,8 BUTTON "PAUSE" SIZE 80,36 PIXEL ACTION TBL_SETPAUSE(oDlg:hWnd)
@ 208,8 SLIDER nSlider HORIZONTAL RANGE 0, 100 SIZE 380,36 PIXEL ON THUMBPOS TBL_SETVALUE(oDlg:hWnd, nVar, 100)
ACTIVATE WINDOW oDlg
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <ShObjIdl.h>
#include <hbapi.h>
ITaskbarList3* TBL_SetProgressState(HWND hWnd, TBPFLAG state)
{
ITaskbarList3* m_pTaskBarlist;
HRESULT hr;
if((hr = CoCreateInstance( &CLSID_TaskbarList, 0, CLSCTX_ALL, &IID_ITaskbarList3, ( void ** ) &m_pTaskBarlist ) )==S_OK)
{
if (state != -1)
m_pTaskBarlist->lpVtbl->SetProgressState( m_pTaskBarlist, hWnd, state );
return m_pTaskBarlist;
}
return NULL;
}
#ifndef _WIN64
#define GETHWND ( HWND ) hb_parnl( 1 )
#else
#define GETHWND ( HWND ) hb_parnll( 1 )
#endif
HB_FUNC( TBL_RESET ) // hWnd
{ TBL_SetProgressState(GETHWND,TBPF_NOPROGRESS); }
HB_FUNC( TBL_PROCESSING ) // hWnd
{ TBL_SetProgressState(GETHWND,TBPF_INDETERMINATE); }
HB_FUNC( TBL_SETPROGRESS ) // hWnd
{ TBL_SetProgressState(GETHWND,TBPF_NORMAL); }
HB_FUNC( TBL_SETVALUE ) // hWnd, n, max
{
HWND hWnd = GETHWND;
ULONGLONG n = hb_parnll(2);
ULONGLONG m = hb_parnll(3);
ITaskbarList3* m_pTaskBarlist = TBL_SetProgressState(GETHWND,-1);
if( m_pTaskBarlist )
{
m_pTaskBarlist->lpVtbl->SetProgressValue( m_pTaskBarlist, hWnd, n, m );
}
}
HB_FUNC( TBL_SETERROR ) // hWnd
{ TBL_SetProgressState(GETHWND,TBPF_ERROR); }
HB_FUNC( TBL_SETPAUSE ) // hWnd
{ TBL_SetProgressState(GETHWND,TBPF_PAUSED); }
#pragma ENDDUMP
Maybe It can be include in the next FiveWin release
![Wink :wink:](./images/smilies/icon_wink.gif)
Regards,
Antonino
- Antonio Linares
- Site Admin
- Posts: 37485
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Windows 7 taskbar button progress bar
Antonino,
Many thanks!![Smile :-)](./images/smilies/icon_smile.gif)
I am testing it with Borland and I get this error:
Borland C++ 5.82 for Win32 Copyright (c) 1993, 2005 Borland
antonino.c:
Error E2141 test.prg 25: Declaration syntax error
We need to make this line Borland 5.82 compatible:
ITaskbarList3* TBL_SetProgressState(HWND hWnd, TBPFLAG state)
Many thanks!
![Smile :-)](./images/smilies/icon_smile.gif)
I am testing it with Borland and I get this error:
Borland C++ 5.82 for Win32 Copyright (c) 1993, 2005 Borland
antonino.c:
Error E2141 test.prg 25: Declaration syntax error
We need to make this line Borland 5.82 compatible:
ITaskbarList3* TBL_SetProgressState(HWND hWnd, TBPFLAG state)
Re: Windows 7 taskbar button progress bar
Hello,
Sorry, I don't have Borland C++, and googling it I don't know how get it.
Anyway, It looks like a Windows Kit version issue, I am using the version 8.1 .
Usual disclaimer (from GPL)
This code is provide "as is" without warranty of any kind. The entire risk as to the quality and performance of the program is with you.![Very Happy :D](./images/smilies/icon_biggrin.gif)
Regards,
Antonino
Sorry, I don't have Borland C++, and googling it I don't know how get it.
Anyway, It looks like a Windows Kit version issue, I am using the version 8.1 .
Usual disclaimer (from GPL)
This code is provide "as is" without warranty of any kind. The entire risk as to the quality and performance of the program is with you.
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Regards,
Antonino
- Antonio Linares
- Site Admin
- Posts: 37485
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Windows 7 taskbar button progress bar
Antonino,
If I try to build it using FWH\samples\buildh32.bat I get these errors:
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
antonino.c
antonino.prg(29) : error C2664: 'HRESULT CoCreateInstance(const IID &,LPUNKNOWN,DWORD,const IID &,LPVOID *)' : cannot convert
argument 1 from 'const CLSID *' to 'const IID &'
Reason: cannot convert from 'const CLSID *' to 'const IID'
No constructor could take the source type, or constructor overload resolution was ambiguous
antonino.prg(32) : error C2039: 'lpVtbl' : is not a member of 'ITaskbarList3'
C:\Program Files (x86)\Windows Kits\8.1\include\um\ShObjIdl.h(17308) : see declaration of 'ITaskbarList3'
antonino.prg(32) : error C2227: left of '->SetProgressState' must point to class/struct/union/generic type
antonino.prg(58) : error C2664: 'ITaskbarList3 *TBL_SetProgressState(HWND,TBPFLAG)' : cannot convert argument 2 from 'int' to
'TBPFLAG'
Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
antonino.prg(61) : error C2039: 'lpVtbl' : is not a member of 'ITaskbarList3'
C:\Program Files (x86)\Windows Kits\8.1\include\um\ShObjIdl.h(17308) : see declaration of 'ITaskbarList3'
antonino.prg(61) : error C2227: left of '->SetProgressValue' must point to class/struct/union/generic type
LINK : fatal error LNK1181: cannot open input file 'antonino.obj'
* Linking errors *
If I try to build it using FWH\samples\buildh32.bat I get these errors:
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
antonino.c
antonino.prg(29) : error C2664: 'HRESULT CoCreateInstance(const IID &,LPUNKNOWN,DWORD,const IID &,LPVOID *)' : cannot convert
argument 1 from 'const CLSID *' to 'const IID &'
Reason: cannot convert from 'const CLSID *' to 'const IID'
No constructor could take the source type, or constructor overload resolution was ambiguous
antonino.prg(32) : error C2039: 'lpVtbl' : is not a member of 'ITaskbarList3'
C:\Program Files (x86)\Windows Kits\8.1\include\um\ShObjIdl.h(17308) : see declaration of 'ITaskbarList3'
antonino.prg(32) : error C2227: left of '->SetProgressState' must point to class/struct/union/generic type
antonino.prg(58) : error C2664: 'ITaskbarList3 *TBL_SetProgressState(HWND,TBPFLAG)' : cannot convert argument 2 from 'int' to
'TBPFLAG'
Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
antonino.prg(61) : error C2039: 'lpVtbl' : is not a member of 'ITaskbarList3'
C:\Program Files (x86)\Windows Kits\8.1\include\um\ShObjIdl.h(17308) : see declaration of 'ITaskbarList3'
antonino.prg(61) : error C2227: left of '->SetProgressValue' must point to class/struct/union/generic type
LINK : fatal error LNK1181: cannot open input file 'antonino.obj'
* Linking errors *
- Antonio Linares
- Site Admin
- Posts: 37485
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Windows 7 taskbar button progress bar
It seems to me as you are using C++ mode, not C mode.
Re: Windows 7 taskbar button progress bar
Hello,
You are using the C++ style, if you look in ShObjIdl.h at line 17366, you can see: above the C++ interface, with method inside the structure, and below the C interface with a structure of pointers at functions that take as first parameter the pointer of interface.
Anyway:
C++:
m_pTaskBarlist->SetProgressState( hWnd, state );
C:
m_pTaskBarlist->lpVtbl->SetProgressState( m_pTaskBarlist, hWnd, state );
I compile with this command:
from the fivewin samples directory.
Here a version that compile in both mode:
You are using the C++ style, if you look in ShObjIdl.h at line 17366, you can see: above the C++ interface, with method inside the structure, and below the C interface with a structure of pointers at functions that take as first parameter the pointer of interface.
Anyway:
C++:
m_pTaskBarlist->SetProgressState( hWnd, state );
C:
m_pTaskBarlist->lpVtbl->SetProgressState( m_pTaskBarlist, hWnd, state );
I compile with this command:
Code: Select all
hbmk2 taskBarList.prg -gui -i..\include -L..\lib -lFiveH32 -lFiveHC32 xhb.hbc -ldflag=Version.lib -ldflag=oledlg.lib -ldflag=gdiplus.lib -ldflag=/NODEFAULTLIB:libcmt
from the fivewin samples directory.
Here a version that compile in both mode:
Code: Select all
#include <fivewin.ch>
#include <slider.ch>
function main()
LOCAL oDlg, oBru, nSlider := 40
DEFINE WINDOW oDlg FROM 0,0 TO 500,400 PIXEL TITLE "TaskBarList" BRUSH oBru
@ 8,8 BUTTON "RESET" SIZE 80,36 PIXEL ACTION TBL_RESET(oDlg:hWnd)
@ 48,8 BUTTON "PROCESSING" SIZE 80,36 PIXEL ACTION TBL_PROCESSING(oDlg:hWnd)
@ 88,8 BUTTON "PROGRESS" SIZE 80,36 PIXEL ACTION (TBL_SETPROGRESS(oDlg:hWnd), TBL_SETVALUE(oDlg:hWnd, nSlider, 100))
@ 128,8 BUTTON "ERROR" SIZE 80,36 PIXEL ACTION TBL_SETERROR(oDlg:hWnd)
@ 168,8 BUTTON "PAUSE" SIZE 80,36 PIXEL ACTION TBL_SETPAUSE(oDlg:hWnd)
@ 208,8 SLIDER nSlider HORIZONTAL RANGE 0, 100 SIZE 380,36 PIXEL ON THUMBPOS TBL_SETVALUE(oDlg:hWnd, nVar, 100)
ACTIVATE WINDOW oDlg
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <ShObjIdl.h>
#include <hbapi.h>
ITaskbarList3* TBL_SetProgressState(HWND hWnd, TBPFLAG state)
{
ITaskbarList3* m_pTaskBarlist;
HRESULT hr;
#if defined(__cplusplus)
if((hr = CoCreateInstance( CLSID_TaskbarList, 0, CLSCTX_ALL, IID_ITaskbarList3, ( void ** ) &m_pTaskBarlist ) )==S_OK)
#else
if((hr = CoCreateInstance( &CLSID_TaskbarList, 0, CLSCTX_ALL, &IID_ITaskbarList3, ( void ** ) &m_pTaskBarlist ) )==S_OK)
#endif
{
if (state != -1)
#if defined(__cplusplus) && !defined(CINTERFACE)
m_pTaskBarlist->SetProgressState( hWnd, state );
#else
m_pTaskBarlist->lpVtbl->SetProgressState( m_pTaskBarlist, hWnd, state );
#endif
return m_pTaskBarlist;
}
return NULL;
}
#ifndef _WIN64
#define GETHWND ( HWND ) hb_parnl( 1 )
#else
#define GETHWND ( HWND ) hb_parnll( 1 )
#endif
HB_FUNC( TBL_RESET ) // hWnd
{ TBL_SetProgressState(GETHWND,TBPF_NOPROGRESS); }
HB_FUNC( TBL_PROCESSING ) // hWnd
{ TBL_SetProgressState(GETHWND,TBPF_INDETERMINATE); }
HB_FUNC( TBL_SETPROGRESS ) // hWnd, n, max
{ TBL_SetProgressState(GETHWND,TBPF_NORMAL); }
HB_FUNC( TBL_SETVALUE )
{
HWND hWnd = GETHWND;
ULONGLONG n = hb_parnll(2);
ULONGLONG m = hb_parnll(3);
ITaskbarList3* m_pTaskBarlist = TBL_SetProgressState(GETHWND,(TBPFLAG)-1);
if( m_pTaskBarlist )
{
#if defined(__cplusplus) && !defined(CINTERFACE)
m_pTaskBarlist->SetProgressValue( hWnd, n, m );
#else
m_pTaskBarlist->lpVtbl->SetProgressValue( m_pTaskBarlist, hWnd, n, m );
#endif
}
}
HB_FUNC( TBL_SETERROR ) // hWnd
{ TBL_SetProgressState(GETHWND,TBPF_ERROR); }
HB_FUNC( TBL_SETPAUSE ) // hWnd
{ TBL_SetProgressState(GETHWND,TBPF_PAUSED); }
#pragma ENDDUMP
- Antonio Linares
- Site Admin
- Posts: 37485
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Windows 7 taskbar button progress bar
I was able to build it removing /TP flag
I have tested it in Windows 10 and it seems not to work:
![Image](https://bitbucket.org/fivetech/screenshots/downloads/antonino.jpg)
I click on the buttons and no action is done
going to digg some more![Smile :-)](./images/smilies/icon_smile.gif)
I have tested it in Windows 10 and it seems not to work:
![Image](https://bitbucket.org/fivetech/screenshots/downloads/antonino.jpg)
I click on the buttons and no action is done
going to digg some more
![Smile :-)](./images/smilies/icon_smile.gif)
Re: Windows 7 taskbar button progress bar
You really hate me! windows 10!!
![Laughing :lol:](./images/smilies/icon_lol.gif)
![Laughing :lol:](./images/smilies/icon_lol.gif)
![Laughing :lol:](./images/smilies/icon_lol.gif)
![Laughing :lol:](./images/smilies/icon_lol.gif)
- Antonio Linares
- Site Admin
- Posts: 37485
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Windows 7 taskbar button progress bar
Antonino,
This control what is supposed to do ? I don't understand what it is for.
I have seen that it is only available from Windows 7 on
This control what is supposed to do ? I don't understand what it is for.
I have seen that it is only available from Windows 7 on
- Antonio Linares
- Site Admin
- Posts: 37485
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Windows 7 taskbar button progress bar
Ok, I found what it does. The color progress bar shown in the taskbar app icon ![Smile :-)](./images/smilies/icon_smile.gif)
I have tested it a few times on Windows 10 and just worked once.
Could other users test this EXE on XP, 7 and 8 ?
https://bitbucket.org/fivetech/fivewin- ... arlist.exe
Thanks for the feedback
![Smile :-)](./images/smilies/icon_smile.gif)
I have tested it a few times on Windows 10 and just worked once.
Could other users test this EXE on XP, 7 and 8 ?
https://bitbucket.org/fivetech/fivewin- ... arlist.exe
Thanks for the feedback
- Antonio Linares
- Site Admin
- Posts: 37485
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Windows 7 taskbar button progress bar
Antonino,
![Smile :-)](./images/smilies/icon_smile.gif)
I use to test Windows betas before they are publically available to check in advance if Harbour/FWH properly work on themAntoninoP wrote:You really hate me! windows 10!!
![]()
![]()
![Smile :-)](./images/smilies/icon_smile.gif)
- Antonio Linares
- Site Admin
- Posts: 37485
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Windows 7 taskbar button progress bar
BTW, Windows 10 10122 is much more stable! ![Smile :-)](./images/smilies/icon_smile.gif)
A very good news
![Smile :-)](./images/smilies/icon_smile.gif)
A very good news
Re: Windows 7 taskbar button progress bar
I am using windows 7 and It should works fine on Windows 8Antonio Linares wrote:Ok, I found what it does. The color progress bar shown in the taskbar app icon
I have tested it a few times on Windows 10 and just worked once.
Could other users test this EXE on XP, 7 and 8 ?
https://bitbucket.org/fivetech/fivewin- ... arlist.exe
Thanks for the feedback
On XP it should fails to create the Interface and manage it.