Skip to content
Advertisement

desktop notifications in service

I wrote a python program that get messages from server and invokes windows notification.

I turned the program into a one file executable using pyinstaller, the program works perfect when running as an app.

when I turned it into a service on windows 10 using nssm.exe, the service still works well(listen & response to the server) but the notifications do not displayed.

I tried to

  • allow service interact with desktop under the service properties > log on.
  • change the registry HKEY_LOCAL_MACHINE>SYSTEM>CurrentControlSet>Control>Windows>NoInteractiveService = 0(False)

Is there anything else I can try to solve this problem?

Edit – the program works great (communication & notification) as a script(.py), and as an executable(.exe), the problem is that the notification do not displayed when the executable is running as a service using nssm.

Advertisement

Answer

Windows Services run in the background, on the isolated Session 0. Their GUI elements (tray icons, windows) will not show up on your interactive desktop.

In previous versions of Windows, you could switch to Session 0 to see your application’s windows (though not it’s tray icon). However, access to Session 0 has been removed in Windows 10.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement