SFML community forums

Help => System => Topic started by: ZeroZ30o on January 23, 2019, 05:45:09 pm

Title: System tray program
Post by: ZeroZ30o on January 23, 2019, 05:45:09 pm
Is there a way, for a process (no console) to interact with its system tray icon?

I've looked up information on microsoft docs:
https://docs.microsoft.com/en-us/windows/desktop/api/shellapi/nf-shellapi-shell_notifyicona
https://docs.microsoft.com/en-us/windows/desktop/api/shellapi/ns-shellapi-_notifyicondataa

But I don't understand how you would get notifications BACK from said API, as it asks for a window handle, which I do not necessarily have in the process.
Title: Re: System tray program
Post by: eXpl0it3r on January 23, 2019, 05:53:04 pm
This is completely unrelated to SFML. It's better to ask such questions on StackOverflow or Microsoft Community.

We like to focus on SFML related topics. :)
Title: Re: System tray program
Post by: ZeroZ30o on January 23, 2019, 06:00:39 pm
Well I was also wondering if SFML would have support for this?
Title: Re: System tray program
Post by: Hapax on January 23, 2019, 08:43:26 pm
[...]as it asks for a window handle, which I do not necessarily have in the process.
Maybe the problem you are having is that you haven't seen how to get the window from SFML:
window.getSystemHandle();
https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Window.php#ad2fa6be5104ec0bfe79af7a5f524ea90
Title: Re: System tray program
Post by: ZeroZ30o on January 26, 2019, 11:02:22 pm
[...]as it asks for a window handle, which I do not necessarily have in the process.
Maybe the problem you are having is that you haven't seen how to get the window from SFML:
window.getSystemHandle();
https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Window.php#ad2fa6be5104ec0bfe79af7a5f524ea90

No, the program has no windows. However you are right in that a window is NECESSARY to use the windows api, even if that window isn't used for anything else and hidden from view.
Title: Re: System tray program
Post by: Hapax on January 27, 2019, 01:58:52 am
That seems like the solution: a hidden window - either hidden by not being shown or by it being displayed out of view.

It does make sense that Windows is based on - and requires - windows. :P