What message do i need to listen into my window procedure to close the GUI
when right-clicking into her taskbar button and clicking on X Close window?
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case ???:
{
//...
}
break;
}
Note: Im not referring to the X into the caption/title bar.
>Solution :
It’s the same message you get when the user presses the [X] button in the caption bar, or chooses Close from the system menu: WM_CLOSE.
The documentation contains useful information. In particular:
An application can prompt the user for confirmation, prior to destroying a window, by processing the
WM_CLOSEmessage and calling theDestroyWindowfunction only if the user confirms the choice.By default, the
DefWindowProcfunction calls theDestroyWindowfunction to destroy the window.