Difference between WM_CLOSE and SC_CLOSE

.net, windows-messages, winforms

Solution

`WM_CLOSE` is sent as a window message whenever the window is requested to be closed, by any means.

`SC_CLOSE` is sent as a parameter of a `WM_SYSCOMMAND` message, when the user presses the Close button (or selects Close from the control menu of the window).

Which one you listen for is determined by which action(s) you attempting to intercept/deal with.

Problem

I just want to know what is the difference between these two messaging constants. Which one should I use in `WndProc` method when overriding, to handle close button message.

Original source