A way to ensure that a system tray icon is removed… guaranteed

后端 未结 8 2455
广开言路
广开言路 2021-02-20 10:21

Is there a way to guarantee that your system tray icon is removed?

To add the system tray icon you do:

Shell_NotifyIcon(NIM_ADD, &m_tnd);


        
相关标签:
8条回答
  • 2021-02-20 11:12

    Another thing most programmers forget to check for is if the explorer restarts/crashes. Its nice if the application handle this and recreate its own icon.

    Just check for Message WM_TASKBARCREATED and recreate the icon.

    0 讨论(0)
  • 2021-02-20 11:15

    Personally I would use a Vectored Exception Handler. Yes, it's based on SEH, but you don't have to deal with all the different stack that you might need to unwind.

    TerminateProcess() is must more destructive. You really can't guard yourself against that; when it happens your process is dead. No ore instructions are processed, so it does not matter what code there is in your application.

    An external application wouldn't really help, would it? It too could crash, or be killed.

    0 讨论(0)
提交回复
热议问题