dmikushin / tray

Cross-platform, super tiny C99 implementation of a system tray icon with a popup menu.
MIT License
87 stars 16 forks source link

fix: windows can not quit when call `exit` #20

Closed jinzhongjia closed 2 months ago

jinzhongjia commented 4 months ago

Windows platform getmessage and peekmessage must use NULL to receive the WM_QUIT message

jinzhongjia commented 4 months ago

WM_QUIT is not a window message and cannot be captured if a window handle is passed in.

dmikushin commented 2 months ago

Hi @jinzhongjia , as this behavior is specific to WM_QUIT, the hwnd should not be changed to NULL for all messages, do you agree? I mean the WM_QUIT-specific case should go inside if (msg.message == WM_QUIT) { ... }, right?

jinzhongjia commented 2 months ago

Oh, I forgot about this PR later. There was a problem with my PR and it should remain as it is, but I didn’t know why I couldn’t capture quit at the time.