"Pop" an alert of some sort in Windows

S

still me

I have a program that I need to run at Windows startup (I can handle
that part, at least as a command line startup->run). But, in some
cases I'd like to pop a window/warning in MS-windows at completion.
I'm really only acquainted with Perl as a command line or cgi
interface.

How can I pop something up in Windows? Do I need a completely
different strategy? I'd prefer not to end up in an MS language... I
just need some sort of alert for certain error conditions at
completion.

Thanks,
 
L

Lambik

still me said:
I have a program that I need to run at Windows startup (I can handle
that part, at least as a command line startup->run). But, in some
cases I'd like to pop a window/warning in MS-windows at completion.
I'm really only acquainted with Perl as a command line or cgi
interface.

How can I pop something up in Windows? Do I need a completely
different strategy? I'd prefer not to end up in an MS language... I
just need some sort of alert for certain error conditions at
completion.

#!/usr/bin/perl
use warnings;
use strict;
use Win32::GUI ();

my $main = Win32::GUI::Window->new(-name => 'Main',
-caption => "I have something to say",
-pos => [100,100],
-size => [300,100],

);
my $label = $main->AddLabel(-text => "We are done running",
-pos => [10,10],
-size => [$main->ScaleWidth() - 100,
$main->ScaleHeight()-50]

);
my $button= $main->AddButton(
-text => 'Ok',
-ok => 1,
-default => 1,
-tabstop => 1,
-pos => [$main->ScaleWidth()-175, $main->ScaleHeight()-25],
-size => [70,20],
-onClick => sub { return -1; },
);

$main->Center();
$main->Show();
Win32::GUI::Dialog();
 
M

Michele Dondi

How can I pop something up in Windows? Do I need a completely
different strategy? I'd prefer not to end up in an MS language... I
just need some sort of alert for certain error conditions at
completion.

Well, just use some toolkit. The most popular one for Perl is Tk, but
there are alternatives.


Michele
 
M

Michele Dondi

use Win32::GUI ();

Why an explicitly empty import list?
my $main = Win32::GUI::Window->new(-name => 'Main',
-caption => "I have something to say",

Remember the Misfits? ("Well I got something to saaaay!")

I installed Win32::GUI but the documentation seems to be lacking both
from command line perldoc (which I generally use) and from the HTML
version: in fact it doesn't seem to follow the standard POD structure,
but the latter has a table of contents with links... which are...
ehm... broken!


Michele
 
L

Lambik

Michele Dondi said:
Why an explicitly empty import list?


Remember the Misfits? ("Well I got something to saaaay!")

I installed Win32::GUI but the documentation seems to be lacking both
from command line perldoc (which I generally use) and from the HTML
version: in fact it doesn't seem to follow the standard POD structure,
but the latter has a table of contents with links... which are...
ehm... broken!

Yes, the docs are not great. The HTML version has 'some' docs and there is a
lot "to be done" among it, so you have to get the fast majority of the info
from the net (http://perl-win32-gui.sourceforge.net/). There is a great
support from the authors though. And the mailing list is active and useful.
I love it. It is very versatile. There are windows stuff you can do which
you can't do with TK and as far as I know not even with wxPerl. Like those
windows you have in MSN Messenger. You know those "someone has signed in"
garbage.
 
M

Michele Dondi

I love it. It is very versatile. There are windows stuff you can do which
you can't do with TK and as far as I know not even with wxPerl. Like those
windows you have in MSN Messenger. You know those "someone has signed in"
garbage.

Well, I wouldn't call it "garbage". I can imagine useful uses for
those. Actually the behaviour with IMs is good. Pidgin, for example,
doesn't at least under Windows, and it only gives an acoustic signal:
so sometimes I maximize it to check who logged in, and of course I
would prefer the notification instead. Said this, the thingie is
*probably* doable in Tk and in other toolkits: it's enough to fork
another process which will consist of a single window, emulating all
the motion by itself, and with special decoration... it is not true
that all Tk apps are forced to have the classical Tk look & feel:
indeed they can be quite different. Of course I've seen *gurus* do
this kinda things, and I'm not, let alone a beginner, so I wouldn't
know where to start, but yes: I think it's *doable*, just not easily.


Michele
 
R

RobMay

Why an explicitly empty import list?

History, and backwards compatibility. Win32::GUI up to V1.04 exports
lots of constants by default (300+ of them), and if you don't want
them you need to apply an empty import list. V1.05 still exports
these constants by default, for backwards compatibility, but warns
with an empty export list - so right now now you need an empty export
list if you don't want the constants, and you don't want the warning.
A future version (probably 1.06, but not decided yet) will stop
exporting the default constants (and will issue a warning without an
empty import list); A further release will remove the warning,
allowing a simple
use Win32::GUI;
to not pollute the caller's namespace. It takes time to change the
past.

Regards,
Rob.
 
R

RobMay

I installed Win32::GUI but the documentation seems to be lacking both
from command line perldoc (which I generally use) and from the HTML
version: in fact it doesn't seem to follow the standard POD structure,
but the latter has a table of contents with links... which are...
ehm... broken!

What version of Win32::GUI, and what version of perl? I fixed the
missing POD documents (I think) with Win32::GUI 1.05. Sadly with
ActivePerl 5.8.8, the way PPM deals with generating HTML from the POD
changed, and despite great efforts to distribute correctly formatted
and linked HTML pages, PPM insists on re-building them , and does so
wrong (if you look at the HTML docs, you'll find all the links are
absolute, and o the directory where the PPM got unpacked. It's on my
list of things to look into for the ext release. In the meantime all
the docs are available on line at http://perl-win32-gui.sourceforge.net/docs/
(although I won't pretend that they are complete or 100% accurate)

Regards,
Rob.
 
M

Michele Dondi

What version of Win32::GUI, and what version of perl? I fixed the

C:\temp>perl -v

This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 50 registered patches, see perl -V for more detail)

Copyright 1987-2006, Larry Wall

Binary build 820 [274739] provided by ActiveState
http://www.ActiveState.com
Built Jan 23 2007 15:57:46

C:\temp>perl -MWin32::GUI=99 -e1
Win32::GUI version 99 required--this is only version 1.03 at
C:/Programmi/Perl/l
ib/Exporter/Heavy.pm line 121.
BEGIN failed--compilation aborted.


Michele
 
L

Lambik

Michele Dondi said:
Strange: it is *already* amongst the repositories I set up in ppm...


Michele
Then I would say: Either you've installed the wrong one (when two are
listed) or you have made a typo in the repository. Because it is really
there.
 
M

Michele Dondi

Then I would say: Either you've installed the wrong one (when two are
listed) or you have made a typo in the repository. Because it is really
there.

Well, I just did

ppm install Win32::GUI

perhaps the order of the repositories does matter? I assumed the most
up to date available version would have been chosen...


Michele
 
M

Michele Dondi

I rather use
ppm search Win32::GUI

Strange:

C:\temp>ppm search Win32::GUI
Downloading ActiveState Package Repository packlist...done
Updating ActiveState Package Repository database...done
Downloading uwinnipeg packlist...not modified
Downloading bribes packlist...done
Updating bribes database...done
Downloading trouchelle packlist...not modified
Downloading SoulCage packlist...done
Downloading SoulCage AppConfig PPD...not modified
Downloading SoulCage Class-Loader PPD...not modified
Downloading SoulCage Convert-ASCII-Armour PPD...not modified
Downloading SoulCage Convert-ASN1 PPD...not modified
Downloading SoulCage Convert-PEM PPD...not modified
Downloading SoulCage Crypt-Blowfish PPD...not modified
Downloading SoulCage Crypt-DES PPD...not modified
Downloading SoulCage Crypt-DES_EDE3 PPD...not modified
Downloading SoulCage Crypt-DH PPD...not modified
Downloading SoulCage Crypt-DSA PPD...not modified
Downloading SoulCage Crypt-Random PPD...not modified
Downloading SoulCage Crypt-Rijndael PPD...not modified
Downloading SoulCage Data-Buffer PPD...not modified
Downloading SoulCage Digest-BubbleBabble PPD...not modified
Downloading SoulCage IO-Select-Trap PPD...not modified
Downloading SoulCage Math-Pari PPD...not modified
Downloading SoulCage Net-SFTP PPD...not modified
Downloading SoulCage Net-SSH-Perl PPD...not modified
Downloading SoulCage Net-SSH-W32Perl PPD...not modified
Downloading SoulCage Template-Toolkit PPD...not modified
1: Win32-GUI
Perl-Win32 Graphical User Interface Extension
Version: 1.03
Author: Robert May ([email protected])
Provide: BuildTools version 0.01
Provide: Config_mO
Provide: SrcParser version 0.01
Provide: Win32::GUI version 1.03
Provide: Win32::GUI::BitmapInline version 0.01
Provide: Win32::GUI::GridLayout version 0.03
Repo: ActiveState Package Repository
CPAN: http://search.cpan.org/dist/Win32-GUI-1.03/
Installed: 1.03 (site)


Michele
 
C

Clenna Lumina

Petr said:
I rather use
ppm search Win32::GUI
and in next step
ppm install X
where "X" is the number of package what I want to select from list
--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

That should be:
ppm search Win32-GUI

They use a hyphen as a separate instead of double colon.
 
M

Michele Dondi

That should be:
ppm search Win32-GUI

They use a hyphen as a separate instead of double colon.

Well, the new version of ppm seems to support the double colon too.
But indeed it only finds version 1.05 of the package doing as you
suggest.


Michele
 
R

RobMay

What version of Win32::GUI, and what version of perl? I fixed the

C:\temp>perl -v

This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 50 registered patches, see perl -V for more detail)

Copyright 1987-2006, Larry Wall

Binary build 820 [274739] provided by ActiveStatehttp://www.ActiveState.com
Built Jan 23 2007 15:57:46

C:\temp>perl -MWin32::GUI=99 -e1
Win32::GUI version 99 required--this is only version 1.03 at
C:/Programmi/Perl/l
ib/Exporter/Heavy.pm line 121.
BEGIN failed--compilation aborted.

OK. Most of the POD was missing from the 1.03 PPM release (and 1.04 I
think) - there was a set of correct HTML pages in this release, but if
you have a latest ActiveState Perl with PPM V4 (which you do), then it
ignores the distributed HTML and tries to re-build it from the POD
(earlier version of PPM did not do this). So in your case there's
(almost) no POD in the distribution, and PPM throws away the
distributed HTML.

I'd thoroughly recommend upgrading to 1.05, as there are a lot of bug
fixes and improvements since 1.03 - I see that you are looking at this
elsewhere in the thread.

Regards,
Rob.
 
M

Michele Dondi

Try
ppm rep
or
ppm help rep

My reporitories are these:

ppm> rep describe

BTW: I now have ppm V4, which either starts a GUI or runs specific
actions from the cli, too bad it has not retained a cli of its own.


Michele
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top