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

Dear Monks,

I have used win32 module, to display message box, for example

sub copyprocess { system ("xcopy $path $xmlpath /S"); Win32::MsgBox("Files copied successfully!"); }
while converting and executing the PERL coding to exe using perlsvc software, message box is not shown, can anybody tell why the message box is not shown when we have converted the perl file to EXE.

Replies are listed 'Best First'.
Re: Problem Using Win32
by starX (Chaplain) on Dec 27, 2007 at 12:29 UTC
    Out of curiosity, does it work before you convert it to .exe? Also, are you converting it to a dependent or a freestanding exe file?

    Very generically, it could be a problem with the perl program, perlsvc, the OS, or the executable. So if it works before the conversion, that helps narrow things down. It's windows, so... umm... try a reboot :)

    If it doesn't work as perl, you might try checking to make sure Win32::MsgBox is up to date. Also, I found this node which might give you an alternative.

    Pretending it does work in perl, is there a way for you to execute the program in a console? It might be trying to print out all sorts of useful error messages that you could be missing if you're double clicking an executable.

    Best,
    starX

Re: Problem Using Win32
by pKai (Priest) on Dec 27, 2007 at 14:25 UTC

    Activestate's perlsvc from their "Perl Developement Kit" converts your Perl program to a Win32 service. If I remember correctly you also have to provide some subs with given name, which perlsvc wraps into an interface to the Windows service controller.

    Im not sure there is a use for a (blocking!) MsgBox inside of service code, let alone on which desktop it will display (desktop of the user the service is installed under, if at all, I assume.)

    If you just want an executable, you'll probably need perlapp from the same Kit.

Re: Problem Using Win32
by Errto (Vicar) on Dec 27, 2007 at 15:38 UTC
    IIRC it is not possible in Windows to show a msgbox, or any other UI component, from a service. At least, not directly. From an ordinary EXE that you run manually, it should work fine.