Progress bar under Windows XP/Activestate Perl

Discussion in 'Perl Misc' started by George, Mar 4, 2006.

  1. George

    George Guest

    After months of hard work, I have finished my perl program while, at
    the same time, reading perldoc.

    I am running Windows XP (SP2), ActiveState Perl v5.8.7. My program is
    about 2000 lines long and it starts with "use strict; use warnings;..."
    (it does not have the #!perl-shebang-line, though).

    It reads in more than 100 megs of plain text-data, moves most of the
    data into a scalar, some into hashes, other into arrays, sorts them,
    rings all sorts of bells and blows the occasional whistle as it goes
    along, before it creates about 500 megs worth of Html, distributed
    (more or less) evenly over 2000 output files.

    It takes 30 minutes run-time for my perl program to complete, so I said
    to myself: "...I am not stupid, man, I shall print some progress
    messages (a simple counter will do) for every 10 lines read to STDERR,
    before I fall asleep while watching the program..."

    I have said it, so I have done it!

    Now, printing the counter to STDERR works fine, but here is the deal:
    ===================================================

    How can I (instead of a counter printed to STDERR) have a window pop up
    with a fancy Microsoft-style progress bar, such as, for example, the
    progress bar displayed by an installation procedure?

    I was thinking of creating a small perl program which runs with
    wperl.exe (so no annoying MS-Dos window pops up), this small perl
    program then calls some sort of Microsoft DLL function to initialise a
    pop-up window for the progress bar.

    Then it "forks" off (I hope this term is politically correct) my
    2000-line-perl-program and spends 30 minutes listening on STDERR to all
    the messages my 2000-line-perl-program will eventually print. For every
    counter printed to STDERR, my small perl program shall advance the
    progress bar in the Microsoft pop-up window by 2 millimetres. In the
    (unlikely) event that my 2000-line-perl-program dies, my small perl
    program should be notified immediately, so it can react accordingly.

    Am I completely wrong here ?

    I hope you guys can push me... (...in the right direction, that is...)

    Thanks in advance

    George
    George, Mar 4, 2006
    #1
    1. Advertising

  2. George wrote:

    > [...]
    > It takes 30 minutes run-time for my perl program to complete, so I said
    > to myself: "...I am not stupid, man, I shall print some progress
    > messages (a simple counter will do) for every 10 lines read to STDERR,
    > before I fall asleep while watching the program..."
    >
    > I have said it, so I have done it!
    >
    > Now, printing the counter to STDERR works fine, but here is the deal:
    > ===================================================
    >
    > How can I (instead of a counter printed to STDERR) have a window pop up
    > with a fancy Microsoft-style progress bar, such as, for example, the
    > progress bar displayed by an installation procedure?
    >
    > I was thinking of creating a small perl program which runs with
    > wperl.exe (so no annoying MS-Dos window pops up), this small perl
    > program then calls some sort of Microsoft DLL function to initialise a
    > pop-up window for the progress bar.
    >
    > Then it "forks" off (I hope this term is politically correct) my
    > 2000-line-perl-program and spends 30 minutes listening on STDERR to all
    > the messages my 2000-line-perl-program will eventually print. For every
    > counter printed to STDERR, my small perl program shall advance the
    > progress bar in the Microsoft pop-up window by 2 millimetres. In the
    > (unlikely) event that my 2000-line-perl-program dies, my small perl
    > program should be notified immediately, so it can react accordingly.


    I think you're looking for a Tk approach.

    Two beautiful examples (complete code to run) at
    http://groups.google.com/group/comp.lang.perl.tk/browse_frm/thread/92f9679d030e1adc/

    --
    Bart
    Bart Van der Donck, Mar 4, 2006
    #2
    1. Advertising

  3. George

    George Guest

    Bart Van der Donck wrote:
    > George wrote:
    >
    > > [...]
    > > How can I (instead of a counter printed to STDERR) have a window pop up
    > > with a fancy Microsoft-style progress bar, such as, for example, the
    > > progress bar displayed by an installation procedure?


    > > [...]


    > I think you're looking for a Tk approach.
    >
    > Two beautiful examples (complete code to run) at
    > http://groups.google.com/group/comp.lang.perl.tk/browse_frm/thread/92f9679d030e1adc/


    Thanks Bart, both Tk-examples work straight out of the box.

    However, I really looking for a 100% Microsoft-style-look-alike
    progress bar.

    I have searched CPAN and I found Win32::API.

    I haven't yet installed it, but according to its doc, I could import a
    function from a 32 bit Dynamic Link Library (DLL) file with the new()
    function. This will create a Perl object that contains the reference to
    that function, which I could later call.

    Now my question:
    Is it reasonable to assume that there exists a Win32 DLL under
    WindowsXP which allows me to display and control a nice, Windows-style
    progress bar ? ...and which I could control under Perl by Win32::API ?
    George, Mar 5, 2006
    #3
  4. George

    Dr.Ruud Guest

    George schreef:

    > Is it reasonable to assume that there exists a Win32 DLL under
    > WindowsXP which allows me to display and control a nice, Windows-style
    > progress bar ? ...and which I could control under Perl by Win32::API ?


    Yes.

    Better ask somewhere else the API-specifics.

    Or google for C++ or VB code, and port that, like:
    http://btmtz.mvps.org/progressbar/

    --
    Affijn, Ruud

    "Gewoon is een tijger."
    Dr.Ruud, Mar 5, 2006
    #4
  5. George schrieb:
    > Bart Van der Donck wrote:
    >
    >>George wrote:
    >>
    >>
    >>>[...]
    >>>How can I (instead of a counter printed to STDERR) have a window pop up
    >>>with a fancy Microsoft-style progress bar, such as, for example, the
    >>>progress bar displayed by an installation procedure?

    >
    >
    >>>[...]

    >
    >
    >>I think you're looking for a Tk approach.
    >>
    >>Two beautiful examples (complete code to run) at
    >>http://groups.google.com/group/comp.lang.perl.tk/browse_frm/thread/92f9679d030e1adc/

    >
    >
    > Thanks Bart, both Tk-examples work straight out of the box.
    >
    > However, I really looking for a 100% Microsoft-style-look-alike
    > progress bar.


    Then you might have a look at Win32::GUI which gives you a more
    comfortable interface then Win32::API

    Karlheinz
    Karlheinz Weindl, Mar 5, 2006
    #5
  6. George

    Dr.Ruud Guest

    Karlheinz Weindl schreef:
    > George schrieb:


    >> looking for a 100% Microsoft-style-look-alike
    >> progress bar.

    >
    > Then you might have a look at Win32::GUI which gives you a more
    > comfortable interface then Win32::API


    http://dada.perl.it/gui_docs/ProgressBar.html

    See http://www.xs4all.nl/~rvtol/perl/ -> Win32_GUI_ProgressBar.pl
    for a code sample.

    --
    Affijn, Ruud

    "Gewoon is een tijger."
    Dr.Ruud, Mar 5, 2006
    #6
  7. George

    George Guest

    Dr.Ruud wrote:
    > Karlheinz Weindl schreef:
    > > George schrieb:

    >
    > >> looking for a 100% Microsoft-style-look-alike
    > >> progress bar.

    > >
    > > Then you might have a look at Win32::GUI which gives you a more
    > > comfortable interface then Win32::API

    >
    > http://dada.perl.it/gui_docs/ProgressBar.html
    >
    > See http://www.xs4all.nl/~rvtol/perl/ -> Win32_GUI_ProgressBar.pl
    > for a code sample.


    Thanks to all who replied to my post.
    I have got now all what I need to wrap my 2000-line-perl program into a
    nice windows gui.

    George
    George, Mar 5, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    0
    Views:
    3,529
  2. Charlie Zhang
    Replies:
    3
    Views:
    1,244
    Paul Lutus
    Aug 16, 2004
  3. Rob

    progress bar or guage bar

    Rob, Jul 11, 2003, in forum: ASP General
    Replies:
    6
    Views:
    188
    Chris Barber
    Jul 12, 2003
  4. Replies:
    4
    Views:
    124
    Michele Dondi
    Dec 2, 2007
  5. Dilbert
    Replies:
    0
    Views:
    831
    Dilbert
    Nov 10, 2011
Loading...

Share This Page