forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Marquee type progress bars
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code
View previous topic :: View next topic  
Author Message
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1537

PostPosted: Fri Oct 22, 2004 2:45 am    Post subject: Marquee type progress bars Reply with quote

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, $0Cool)
      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
View user's profile Send private message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1054
Location: India

PostPosted: Fri Oct 22, 2004 8:32 am    Post subject: Reply with quote

Nice one PGWARE Smile
_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Fri Oct 22, 2004 11:31 am    Post subject: Reply with quote

Goody ! Very Happy Thanks PK!
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Fri Oct 22, 2004 12:32 pm    Post subject: Reply with quote

Way cool! Cool
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sun Oct 24, 2004 2:18 am    Post subject: Reply with quote

Nice job Thumbs Up
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Tue Oct 26, 2004 1:24 pm    Post subject: Reply with quote

does not work under windows 98se Sad

don't worry about fixing it . . . i'm just letting you know Smile


serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Tue Oct 26, 2004 2:57 pm    Post subject: Reply with quote

What does it display under Windows 98, just a blank progressbar, or is it moving like a normal one insteed of the "marquee" style ? Smile
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1537

PostPosted: Tue Oct 26, 2004 5:16 pm    Post subject: Reply with quote

I should have mentiond the code only works with Windows XP and 2003 Smile 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
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Wed Oct 27, 2004 2:55 pm    Post subject: Reply with quote

skit - i get a blank progress bar with no motion whatever

thanks for the confirmation pg

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mcpaton
Newbie


Joined: 27 Jul 2005
Posts: 13

PostPosted: Wed Jul 27, 2005 1:24 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1537

PostPosted: Wed Jul 27, 2005 1:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
mcpaton
Newbie


Joined: 27 Jul 2005
Posts: 13

PostPosted: Wed Jul 27, 2005 1:59 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Wed Jul 27, 2005 2:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
mcpaton
Newbie


Joined: 27 Jul 2005
Posts: 13

PostPosted: Wed Jul 27, 2005 2:32 pm    Post subject: Reply with quote

will that use more CPU usage to run the loop?

Is the loop simple to code up?
Back to top
View user's profile Send private message Visit poster's website
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Wed Jul 27, 2005 3:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group