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.