View previous topic :: View next topic |
Author |
Message |
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1563
|
Posted: Fri Oct 22, 2004 2:45 am Post subject: Marquee type progress bars |
|
|
This code allows you to have a marquee type progress bar; which is a progress bar that does not keep track of a value but scrolls/animates back and forth infinately - you've probably seen this during Windows updates and other similar tasks.
Code: |
#define command,MARQUEEPROGRESS
title MarQuee Progress Test
DIALOG CREATE,MarQuee Progress Test,-1,0,240,160
DIALOG ADD,PROGRESS,PROGRESS1,67,33,170,20,0
DIALOG SHOW
rem this is a custom command, you need to pass the name of
rem progress bar (here it is 'progress1', then we pass how fast
rem we want the progress bar marquee to animate. I set it to
rem 50 milliseconds - which determines time between progress
rem bar animations.
MARQUEEPROGRESS PROGRESS1,50
:evloop
wait event
goto @event()
:close
exit
rem This command turns the marquee progress on for the progressbar
:MARQUEEPROGRESS
if @winexists(~%1)
if @numeric(%2)
rem here we set the window style PBS_MARQUEE to the progressbar
loadlib user32.dll
%X = @lib(user32, GetWindowLongA, INT:, @strdel(@winexists(~%1), 1, 1), -16)
%Z = @lib(user32, SetWindowLongA, INT:, @strdel(@winexists(~%1), 1, 1), -16, @sum(%X, $0)
rem here we turn the marquee on using PBM_SETMARQUEE message
%X = @sendmsg(@winexists(~%1), @sum($400,10), 1, %2)
rem to turn off the marquee simply use the window message below
rem %X = @sendmsg(@winexists(~%1), @sum($400,10), 0, 0)
freelib user32.dll
end
end
exit
|
|
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Fri Oct 22, 2004 8:32 am Post subject: |
|
|
Nice one PGWARE _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
marty Professional Member
Joined: 10 May 2001 Posts: 789
|
Posted: Fri Oct 22, 2004 11:31 am Post subject: |
|
|
Goody ! Thanks PK! |
|
Back to top |
|
|
Boo Valued Contributor
Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Fri Oct 22, 2004 12:32 pm Post subject: |
|
|
Way cool! |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sun Oct 24, 2004 2:18 am Post subject: |
|
|
Nice job _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Tue Oct 26, 2004 1:24 pm Post subject: |
|
|
does not work under windows 98se
don't worry about fixing it . . . i'm just letting you know
serge _________________
|
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1563
|
Posted: Tue Oct 26, 2004 5:16 pm Post subject: |
|
|
I should have mentiond the code only works with Windows XP and 2003 The api was only added within those two versions of Windows; obviously previous versions of Windows will not work.
If you take a look in the general forum Skit posted an excellent example which replicates the marquee and works with any version of Windows. |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Wed Oct 27, 2004 2:55 pm Post subject: |
|
|
skit - i get a blank progress bar with no motion whatever
thanks for the confirmation pg
serge _________________
|
|
Back to top |
|
|
mcpaton Newbie
Joined: 27 Jul 2005 Posts: 13
|
Posted: Wed Jul 27, 2005 1:24 pm Post subject: |
|
|
I'd actually like to know how to make a progress bar move (infinately) while i run a batch file, then complete the progress bar when the batch file finishes....
is this possible with a modification of this script? Currently the progress bar stops when my batch file is running and it hits the "wait" bit that stops my script moving on until after the batch file completes... |
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1563
|
Posted: Wed Jul 27, 2005 1:45 pm Post subject: |
|
|
Turn the marquee on with the code above then when you want the progress to complete with 100% you simply turn off the marquee property with the code:
%X = @sendmsg(@winexists(~PROGRESS1), @sum($400,10), 0, 0)
then you set the progress bar to 100%:
DIALOG SET,PROGRESS1,100 |
|
Back to top |
|
|
mcpaton Newbie
Joined: 27 Jul 2005 Posts: 13
|
Posted: Wed Jul 27, 2005 1:59 pm Post subject: |
|
|
thanks for that, however it doesnt show a 100% full progress bar upon completion, and it still stops animating while the program waits for the batch file to finish running.... |
|
Back to top |
|
|
jwfv Valued Contributor
Joined: 19 Mar 2002 Posts: 422 Location: Beaufort, SC
|
Posted: Wed Jul 27, 2005 2:29 pm Post subject: |
|
|
If you run the external program with the WAIT parameter of the RUN command, I don't think there is any way for the progress bar to keep animating.
One option is to run the external program without the WAIT parameter, you can set up a short timer loop to see if the program is still running, while the progress bar keeps animating. Then when the external program is not still in the tasklist, you can move on from there. _________________ Joe Floyd |
|
Back to top |
|
|
mcpaton Newbie
Joined: 27 Jul 2005 Posts: 13
|
Posted: Wed Jul 27, 2005 2:32 pm Post subject: |
|
|
will that use more CPU usage to run the loop?
Is the loop simple to code up? |
|
Back to top |
|
|
jwfv Valued Contributor
Joined: 19 Mar 2002 Posts: 422 Location: Beaufort, SC
|
Posted: Wed Jul 27, 2005 3:32 pm Post subject: |
|
|
It shouldn't affect the CPU.
Here is an example of something I have used. I don't know if it is the best way to code it or not. Perhaps a guru around here can tweak it.
Code: | run testprog.exe
wait 2
repeat
list CLEAR, 15
LIST TASKLIST, 15
list seek, 15, 0
wait 1
until @not(@match(15,testprog)) |
This runs the program testprog.exe and then loops until it is finished. If you are running Windows XP/2000 then the marquee style progress bar will keep looping while this runs. If it is Win 98, you will need to add in a progress bar update in the middle of the loop.
One potential problem: make sure that only one instance of "testprog" will be running at a time.
Also note: I put the "WAIT 2" command in the code just to give testprog.exe time to open up before the checking of the tasklist begins.
Hope this helps.
Joe _________________ Joe Floyd |
|
Back to top |
|
|
|