Service Alert Popups in Python

I use win32api.MessageBox to generate alerts, and this works for applications launched from an interactive prompt and usually executable code, however, when I created the Python service when the MessageBox is triggered, I hear a “beep”, but the box does not appear. Can I display alerts from services?

+3
source share
1 answer

No, Windows services run on a completely separate hidden desktop and do not have access to the desktop computer being loaded by the user. From the point of view of a service developer, this is not so.

In previous versions of Windows, the service could be marked as "allowed to interact with the user's desktop," but this option was removed in XP or Vista (I forgot that). Now services cannot interact with the user's desktop.

One solution to your problem might be to have a desktop application that communicates with the service through some IPC method. When a service wants to alert a user of a condition, it will notify the desktop application, which will then display a regular message box.

+5
source

Source: https://habr.com/ru/post/1698292/


All Articles