我想写一个 截获 系统关机 消息的例子 请求帮助!为什么下面的例子截获 不到 消息 !
#include <windows.h>
 
#include <stdio.h>
int main()
{
 BOOL bRet;
 MSG msg;
 while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
 { 
    if (bRet == -1)
    {
        // handle the error and possibly exit
    }
    else
    {
   if(msg.message == WM_QUERYENDSESSION)
  {
   printf("yeah-----!!!!!!!!!!----!!!!\n");
   return 0;
  }
        TranslateMessage(&msg); 
        DispatchMessage(&msg); 
    }
}
 
 return 1;
}我想获得系统关机消息 在关机 前打印出 着句话 “yeah-----!!!!!!!!!!----!!!!\n”
不知道怎么调试!!请执叫