Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ProgressTaskbar: Show Your own ProgressBar in the Windows Taskbar (Windows 7 / 8 / 8.1 / 10 / 11) 4

Status
Not open for further replies.

StefanFoerner

Programmer
Mar 23, 2015
93
DE
Hi erveryone,

Just as you can use the normal ProgressBar to create a progress bar on a form, the VFP developer can use this free DLL ProgressTaskbar.dll to visually spice up VFP Apps and create a progress bar in the taskbar of Windows 7 / 8 / 8.1 / 10 / 11 !!!

Just like e.g. the progress bar in the Windows Explorer taskbar when copying many folders and large files!!!

The DLL ProgessTaskBar.dll exports only one (!!!) function: SetProgressTaskbar(). This internally calls the two methods SetProgressValue() and SetProgressState() from the ITaskbarList3 interface (C++ source code attached, see: ProgressTaskbar.cpp).

1) Method SetProgressValue(): [URL unfurl="true"]https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setprogressvalue[/url]

2) Method SetProgressState(): [URL unfurl="true"]https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setprogressstate[/url]

The DLL ProgressTaskbar.dll can be used e.g. simply copy it into the folder of your own VFP program executable or install it there.


Before calling, you must of course declare the SetProgressTaskbar() function in your own program:

Code:
#DEFINE TBPF_NOPROGRESS    0
#DEFINE TBPF_INDETERMINATE 1
#DEFINE TBPF_NORMAL        2	&& green color
#DEFINE TBPF_ERROR         4	&& red color
#DEFINE TBPF_PAUSED        8	&& yellow color

DECLARE INTEGER SetProgressTaskbar IN PROGRESSTASKBAR.DLL;
	INTEGER hWnd,;
	INTEGER valueVal,;
	INTEGER maxVal,;
	INTEGER stateVal

SetProgressTaskbar( hWnd, valueVal, maxVal, stateVal )


hWnd: use the hWnd of Your Main Top Level Form

To create a normal display (green) of 30%: SetProgressTaskbar( hwnd, 30, 100, TBPF_NORMAL )

To create a pause indicator (yellow) of 50%: SetProgressTaskbar( hwnd, 50, 100, TBPF_PAUSED )

To generate an error display (red) of 100%: SetProgressTaskbar( hwnd, 100, 100, TBPF_ERROR )

To create a scrolling display: SetProgressTaskbar( hwnd, 0, 0, TBPF_INDETERMINATE )

To stop displaying: SetProgressTaskbar( hwnd, 0, 0, TBPF_NOPROGRESS )

Tip 1: in conjunction with a timer you can also make the taskbar flash! You call e.g. SetProgressTaskbar( hwnd, 100, 100, TBPF_PAUSED ) and SetProgressTaskbar( hwnd, 0, 0, TBPF_NOPROGRESS ) alternately every 500 msec.

Tip 2: You can achieve the greatest visual WOW effect if you let the normal ProgressBar on the form and the ProgressTaskbar in the Windows Taskbar progress at the same time.

For a detailed description of the parameters hwnd, valueVal, maxVal, stateVal and the flags TBFN_... see the two links 1) and 2) above.

You can see what the ProgressTaskbar can look like here: [URL unfurl="true"]http://www.memotech.de/ProgressTaskbar/ProgressTaskbar.jpg[/url]

License conditions: none! no costs! no support! no warranty! free use! free distribution with your own programs!


Download: www.memotech.de/ProgressTaskbar/ProgressTaskbar.zip


Regards, Stefan
 
That looks really interesting, thank you.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
Thankx for Your feedback

I hope everyone has fun with this feature :)

Regards, Stefan


I have started developing with Visual FoxPro in 1997

under and for all Windows versions:

Windows 95
Windows 98
Windows 2000
Windows Me
Windows XP
Windows Vista
Windows 7
Windows 8
Windows 8.1
Windows 10
Windows 11
and Windows 12 can come ...

PS: Visual FoxPro will always be alive, now and in the future!
 
It works with any own top level form, I wonder why it doesn't work with the _screen.hwnd, though.

Chriss
 
Hi Chris,

please try:

Code:
DECLARE INTEGER SetProgressTaskbar IN PROGRESSTASKBAR.DLL;
	LONG hWnd,;		&& <= LONG !!!
	INTEGER valueVal,;
	INTEGER maxVal,;
	INTEGER stateVal

VFP Help:

INTEGER 32-bit integer
LONG 32-bit long integer

- I really don't know what should be the difference between integer and long integer, both are 32 bit ...

Regards, Stefan
 
The problem isn't the hwnd parameter type. I found the culprit, to make the taskbar progress work for the IDE itself, you have to use _Vfp.hwnd, not _screen.hwnd, even though _screen.ShowInTaskBar is .T. and suggests, that's the main IDE window represented in the taskbar.

Maybe it's also differing by Windows versions, but on Windows 10 the function will only work for the _vfp.hwnd.

Chriss
 
Sure, good to know.

I should have tried that instantly, it's not the first time the _vfp vs _screen hwnd matters for using related Windows API functions or sending messages, etc.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top