I've searched around but I'm still not entirely sure how it works. I understand the concept that, for example, Windows sends out the WM_QUERYENDSESSION message to all windows and that they then respond. But how?
Code:
#include <Windows.h>
#include <stdio.h>
LRESULT CALLBACK WindowProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
if (iMsg == WM_QUERYENDSESSION) {
//respond
}
}
int main()
{
while (1) {}
return 0;
}
Is that correct so far and the WindowProc function is called automatically when a message is recieved?
Assuming that is correct, how do I respond to the message (either true or false)? Return from the WinowProc function?