#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
hbmk2 taskBarList.prg -gui -i..\include -L..\lib -lFiveH32 -lFiveHC32 xhb.hbc -ldflag=Version.lib -ldflag=oledlg.lib -ldflag=gdiplus.lib -ldflag=/NODEFAULTLIB:libcmt
#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
AntoninoP wrote:You really hate me! windows 10!!
Antonio 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-contributions/downloads/taskbarlist.exe
Thanks for the feedback
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: cmsoft and 39 guests