Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Statusbar icon "shell" to hide console window?

by EvanK (Chaplain)
on Mar 21, 2004 at 18:35 UTC ( [id://338496]=perlquestion: print w/replies, xml ) Need Help??

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

ok, running win2k, I have a small server-type script containing some socket operations, and it does its job correctly and efficiently, and i want to leave it running all the time...BUT, i need a better way to manage it than the ugly dos window (ive tried wperl.exe, but it seems to screw up the script). heres what im thinking to do:

-create an icon in the statusbar, and attach to it a context-menu, through which i can manage the script

-hide the dos window

now, i have a little experience with win32::gui, but i'd have no idea how to do something like this, and i've also heard good things about wxPerl, but i have NO experience with it. which gui module would be better to use, and where could i find similar example code?

thanks for any help provided.

  • Comment on Statusbar icon "shell" to hide console window?

Replies are listed 'Best First'.
Re: Statusbar icon "shell" to hide console window?
by arden (Curate) on Mar 21, 2004 at 20:33 UTC
    EvanK, if all you really want is a way to run the script 24/7 without it being in the way, you might consider running it as a service on Win2K. It's really easy to set up any program as a service using instsrv.exe and srvany.exe from the M$ Resource Kit. If you don't have the resource kit yourself, you could check it out from most any public library or just download the two executables from the InterNet. You can then start/stop/pause your script/service from any command-line with  net stop myservicename

    Alternatively, if you really need to have access to your script via the application tray, you could use ActiveState's perltray, a part of the Perl Developers Kit. You would have to write more code to handle the windows events for tray applications and the PDK is payware, but you can at least get an evaluation license which is good for 21 days to see if it will meet your needs (and if you can/want to write the additional code to handle the events).

    - - arden.

Re: Statusbar icon "shell" to hide console window?
by The Mad Hatter (Priest) on Mar 21, 2004 at 19:30 UTC
    Check out Win32::GUI::NotifyIcon which seems to provide you with a way to get the tray icon (you still have to deal with coding the events, and what not). FYI, I've never used it myself.

    You might also want to subscribe to the perl-win32-gui-users mailing list and possibly ask around there.

    Update Changed first para to be more accurate. Added second para.

Re: Statusbar icon "shell" to hide console window?
by jZed (Prior) on Mar 21, 2004 at 18:57 UTC
    I don't know about win2k but on win98, I simply drag and drop the server script from explorer onto the taskbar, that creates an icon for it. The first time I click on the icon, the server sript comes up in a DOS console window. I click in the upper left corner of that window and get a menu with "Properties" as one of the options. I select Properties and then have the option to fill in the "Run" box as "Normal, minimized, mazimized". I select minimized, then close the window. Thereafter when I click on the taskbar icon the server runs minimized and I don't see any console window.
      I think the OP wants a tray icon from which to control the script and hide the DOS box from view at all (both of which can be done), not a taskbar shortcut.
        Well, my way will hide the DOS box from view, but you're right, it won't provide a tray icon to control the app.
Re: Statusbar icon "shell" to hide console window?
by EvanK (Chaplain) on Mar 22, 2004 at 06:33 UTC
    wow, thanks a bunch for all the replies. right now i'm trying to use Win32::GUI::NotifyIcon, and I think i've about got it working. thanks all :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://338496]
Approved by ybiC
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-23 08:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found