Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Win32::SysTray Issue

by jcb (Parson)
on Oct 18, 2020 at 02:51 UTC ( [id://11122971]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Win32::SysTray Issue
in thread Win32::SysTray Issue

If Win32::GUI is like Tk, you may be able to run the event loop in a "forked process" (perl emulates fork using threads on Windows) while your main program continues on with the menu choices. Arranging IPC in this scenario to make the systray icon anything more than a simple reminder that the program is running is up to you.

Try:

$tray->runApplication unless fork;

Replies are listed 'Best First'.
Re^4: Win32::SysTray Issue
by PilotinControl (Pilgrim) on Oct 18, 2020 at 11:55 UTC
    that works however all it does is allow the main program to work and the icon menu does not...the program does not hang up anymore. Half solved.

      That would be the first step; the rest involves setting up some kind of IPC between "parent" and "child" so that the icon menu can influence the main script's processing.

      An anonymous monk provided a better solution: simply call Win32::GUI::DoEvents­ periodically in your code. Note that this option means that the icon will be unresponsive until a DoEvents call is reached, so it does need to be called fairly often, such as on each iteration of any time-consuming loop.

      I use Tk on X11, so I am not particularly familiar with Windows GUI programming, but this seems to be similar to the type of problem I have solved in the past by forking workers and having them return results back to a main GUI process using pipes. In your case, the issue is a bit more complicated by the need for the GUI to be the side task. The *nix traditional solution would be to write an event-driven GUI wrapper for the command-line program but I do not know how well this strategy will work on Windows.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-19 18:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found