Strawberry Win32 GUI programming

jdavidb on 2010-06-09T15:10:53

If I wanted to write a Strawberry program to run as a daemon and periodically pop up alerts on my machine, and I had no Windows Perl GUI programming experience other than an abortive look at WxPerl years before anybody ever thought of Strawberry, what module would I be looking for?


Any of the GUI toolkits

tsee on 2010-06-09T16:56:09

Any of the GUI toolkits that are available from CPAN?

- Wx
- Tk
- Win32::GUI ...

Should all work either out of the box or after a simple "cpan" invocation. I haven't used the latter toolkit, though.

Re:Any of the GUI toolkits

jdavidb on 2010-06-09T19:12:22

To clarify, I was looking for recommendations. I figured everybody would say Win32::GUI, but I wanted to see what prevailing thought is.

Re:Any of the GUI toolkits

Alias on 2010-06-10T01:07:06

For simple jobs where the gui is incidental and doesn't dominate the application, I'd probably agree on Win32::GUI is you can deal with it.

Growl

link on 2010-06-09T18:14:26

This sounds like something growl would be a decent match for. I have not used it myself but Growl::GNTP should let you send notifications to growl from perl.

Re:Growl

jdavidb on 2010-06-09T19:14:31

Hmm, Growl looks like it's going to solve a number of my problems. Unfortunately I simplified my original question and I'm not sure Growl alone will be up to that task. But I think I owe you lunch for showing me this!

Re:Growl

jdavidb on 2010-07-27T14:27:08

Thank you very much for this suggestion. Growl turned out to be perfect for a LOT of things I want to do.

Do you even need a toolkit?

bart on 2010-06-15T07:41:16

As you said

periodically pop up alerts on my machine

do you even need a GUI toolkit? It seems to me like a plain MessageBox API call is all you need.

That is, unless you want the script to continue running while the message is shown. In that case, you could set up a simple window with The GUI Loft. Oldie, but probably good enough.

And I've never seen a service with a GUI, I'm not sure if it will behave nicely.

Re:Do you even need a toolkit?

jdavidb on 2010-06-21T18:54:27

Actually I think I'll probably input a couple of things into the dialog box, so it's more than just a message box.

But I'm unclear on what you're suggesting ... write XS code? Or is there some standard way to call MessageBox from Perl? I'm pretty ignorant. :)

Re:Do you even need a toolkit?

bart on 2010-06-23T09:51:20

I said

And I've never seen a service with a GUI, I'm not sure if it will behave nicely.

and today I found this blog post: Do you still use the MessageBox API in your Windows Service? (Or do you display any type of User Interface?)

and it says:

Starting with Windows Vista and above, user interfaces generated by Windows services can’t be seen. And even worst, your service could be stuck waiting for some user input that the user cannot give as she does not see anything!

It goes on to give a generic solution (plus a simple solution for just a messagebox), but it's anything but trivial.

But I was right to be wary.

And I'm not sure that this solution will work on a Windows earlier than Vista. At worst, you might have to hack in 2 interfaces, for multiple versions of Windows.