Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: System tray program  (Read 8442 times)

0 Members and 1 Guest are viewing this topic.

ZeroZ30o

  • Newbie
  • *
  • Posts: 47
    • View Profile
System tray program
« 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: System tray program
« Reply #1 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. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

ZeroZ30o

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: System tray program
« Reply #2 on: January 23, 2019, 06:00:39 pm »
Well I was also wondering if SFML would have support for this?

Hapax

  • Hero Member
  • *****
  • Posts: 3346
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: System tray program
« Reply #3 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
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

ZeroZ30o

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: System tray program
« Reply #4 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.

Hapax

  • Hero Member
  • *****
  • Posts: 3346
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: System tray program
« Reply #5 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
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*