After the wpf program starts, there is no interface and no icon.

I need to capture the startup and shutdown messages of windows, so I need an interface. After I do boot, the program does call my method in the background, but there is no interface, so I cannot receive the shutdown message of windows. But if I open the program normally and then shut down, it will work normally, and an icon will appear in the taskbar.
ask for divine support.


whether there is a interface has nothing to do with whether you can accept windows messages or not.
in addition, to describe the problem in more detail, very few people in this community ask .net


to open the task manager, find the process, and see if the session ID is 0?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30c8a-2bd4d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30c8a-2bd4d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?