I am making a program with native C++ and the WinAPI.
This program has a main application window that I want to be somewhat persistent. It seems kind of natural to close a window via the red X button, and I often accidentally press it when I don't actually want to exit the program (this happens to me with Teamspeak). So, I'm trying to repurpose the red X button into a minimize button to avoid accidental exiting.
However, my application should have some way to exit the program with standard system controls. I want to allow ALT+F4 and right clicking on the taskbar icon to close. I tried intercepting WM_CLOSE and SYSCOMMAND (SC_CLOSE) but this seems to disable all standard system methods of exiting the program (short of killing it in Process Explorer - not really a standard method).
Is there a way to only intercept the window's red X button? I noticed that Windows Live Messenger does this but I have no idea how.