Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Win32::SysTray Issue

by Corion (Patriarch)
on Oct 17, 2020 at 06:01 UTC ( [id://11122938]=note: print w/replies, xml ) Need Help??


in reply to Win32::SysTray Issue

I guess that $tray->runApplication starts the event loop for your program. That loop only returns once your program quits.

If you have what is basically a console program without an event loop and event architecture, you will have to post a Short Self-Contained Correct Example to demonstrate your problem. Then, we can maybe suggest how to change your program logic so it works together with the Windows event loop.

As the documentation of Win32::SysTray says, it invokes Win32::GUI::Dialog, so basically it will involve rewriting your application in terms of Win32::GUI.

Replies are listed 'Best First'.
Re^2: Win32::SysTray Issue
by PilotinControl (Pilgrim) on Oct 18, 2020 at 01:22 UTC

    I wondered about that myself and I think...I have not tested it yet...that Win32::GUI::Dialog is just for the systray icon menu as the one poster above was able too print to the console and run the icon menu code at the same time. However my whole program is quite console intensive as its a series of menu choices.

      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;
        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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-25 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found