Just that, how do I get a progress bar to display the percentage it is complete in the middle like most apps do. It documents that it "processes the WM_GETFONT and WM_SETFONT messages to display text" so I dont think its something I have to draw myself. But I cant find the style to get it to show it.

If anybody could help it woul;d be thanks a million :)
Posted on 2001-12-06 03:39:23 by huh
The progress bar you see in most apps is not the standard progress bar, it is a combination of a pic box and a rect shape (talking in VB talk). If you are familiar with VB, you will know the controls i am talking about, and should be able to easily aproximate them in asm.

If you would like to see some VB code that does this, let me know and i will email you a simple project tomorrow.
Posted on 2001-12-06 04:53:30 by sluggy
your conclusion seems logical but ....

from the SDK docu:

progressbar handles WM_SETFONT:
Saves the handle to the new font and returns the handle to the previous font. The progress bar does not currently draw text, so sending this message has no effect on the control.
Posted on 2001-12-06 06:46:08 by beaster
The progress bar does not currently draw text, so sending this message has no effect on the control.

This is true.
To achieve the text, just layer a transparent STATIC type window over top of the progress bar, and set the text in that. You will have to fiddle with the pen styles to get the text to XOR its color as the progress bar progresses under it. Also, in my first post, i missed the fact that you can create the progress bar with the PBS_SMOOTH style to get a non-segmented look.

huh, if you find exactly what pen style to use for the text in the STATIC window, let me know (saves me time in the future...)
Posted on 2001-12-06 07:06:24 by sluggy
Here it is, instead of using a sattic window I have hooked the progress bars class WndProc and drawn the text directly onto the window. The two major problems are, the progress bar doesn't erase its background so I had to do this for it, and if the program trys to set the background color it will probably screw everything up.

This proc will work for all progress bars of an app, and only needs to be implemented like this



invoke CreateWindowEx ,NULL,ADDR ProgressClass,.......
invoke SetWindowLong ,eax,GWL_WNDPROC,ProgressWindowProc
mov lpfnProgressWndProc,eax
invoke CreateWindowEx ,NULL,ADDR ProgressClass,.......
invoke SetWindowLong ,eax,GWL_WNDPROC,ProgressWindowProc
invoke CreateWindowEx ,NULL,ADDR ProgressClass,.......
invoke SetWindowLong ,eax,GWL_WNDPROC,ProgressWindowProc


With this proc:
C:\WINDOWS\Profiles\George\Desktop\jcalg1_r528\progressproc.asm
Posted on 2001-12-07 19:08:48 by huh
Sorry, i will try again:

C:\WINDOWS\Profiles\George\Desktop\jcalg1_r528\progressproc.asm
Posted on 2001-12-07 19:10:02 by huh