http://qs321.pair.com?node_id=47135

punksk8er has asked for the wisdom of the Perl Monks concerning the following question:

I have looked over all the samples and all the pods for it and still I have not been able to understand how to use it.
Especially with the samples not working for me.

Replies are listed 'Best First'.
Re: How do I use Win32::GUI properly?
by c-era (Curate) on Dec 18, 2000 at 18:28 UTC
    If the samples aren't working you probably don't have the latest version, or you grabbed active perl's ppm (which seems to be flaky). It is best if you download it from dada.perl.it. Below is a piece of code that should show you "Hello World".
    use strict; use Win32::GUI; # First we create a window my $window = Win32::GUI::Window->new ( -width => 200, # Set the width -height => 200, # Set the height -text => "Hello World Title", # Set the title -name => "window1", # Set the name (used for event handlers) ); # Next we create a font (optional) my $font = Win32::GUI::Font->new ( -size => 20, # Set the size (in points) -name => "Comic Sans MS", # Name of the font ); # Then we add a lable to our window my $lable = $window->AddLabel( -text => "Hello World", # Set the text in the label -font => $font, # Set the font -foreground => [0, 0, 255], # Set the color of the text ); # Make sure you show your window $window->Show (); # This starts the event loop so we can now respond to events Win32::GUI::Dialog(); # The only event we want to respond to is the terminate event # The name of a sub to run an event is in the form "name_event" # If the terminate event sub is not specified your program won't exit +if you hit the x sub window1_Terminate { return -1; # Return -1 to end the event loop }
Re: How do I use Win32::GUI properly?
by punksk8er (Initiate) on Dec 19, 2000 at 10:39 UTC
    I have activestate's perl PPM.
    I also have the newest version that I downloaded the newest from dada.perl.it
    Are there any other windows perl interpreters that I would be able to download that would work with Win32::GUI?

    Originally posted as a Categorized Answer.

Re: How do I use Win32::GUI properly?
by Anonymous Monk on Feb 05, 2004 at 20:46 UTC
    1. Save the file as normal.
    2. use perlapp to create the executable e.g. perlapp -gui filename.pl
    That will create filename.exe which you can execute to view the results. The -gui prevents any console window opening.

    Hope that helps

    Imam Chishty

    Originally posted as a Categorized Answer.

Re: How do I use Win32::GUI properly?
by Anonymous Monk on Nov 06, 2002 at 08:40 UTC
    does not seem to work with win nt sp6 terminal server... active perl and win32::gui ppm version 0.503-something.

    Originally posted as a Categorized Answer.