Both X and the system context menu send the same Windows message; do not think that you can easily split the action. This is also Alt + F4 post.
I would also say that I would not like this non-standard behavior, if I get into X, I want it to be closed, and not minimized, then that for button 2 on the left.
Perhaps the best approach to looking and feeling wrong is to not display the X button by default - disable the default function, and instead draw your own event. This can go bad in the system context menu, so you no longer have the close option.
Greg domjan
source share