消息循环是一个无限的for循环,那么程序还怎么响应发送的消息呀?
刚学习vc,建了一个简单的对话框程序,试验一下发送消息和寄送消息时,看到程序一开始就运行在无限消息循环for (;;)里面,但是一旦响应发送消息,程序立刻就跳出这个消息循环,真是不明白呀,请各位大大帮我解惑,下面是发送消息和寄送消息的调用堆栈。
寄送消息时:
。
。
。
mfc71d.dll!AfxInternalPumpMessage() Line 183 + 0x18 C++
mfc71d.dll!CWinThread::PumpMessage() Line 916 C++
mfc71d.dll!AfxPumpMessage() Line 195 + 0xb C++
//由下可见程序应该一直运行在无限消息循环for (;;)里面啊
mfc71d.dll!CWnd::RunModalLoop(unsigned long dwFlags=4) Line 4566 + 0x5 C++
mfc71d.dll!CDialog::DoModal() Line 527 + 0xc C++
test1.exe!Ctest1App::InitInstance() Line 58 + 0xb C++
mfc71d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ *
test1.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000,
test1.exe!WinMainCRTStartup() Line 390 + 0x39 C
kernel32.dll!7c816fd7()
ntdll.dll!7c935b4f()
发送消息时:
。
。
。
mfc71d.dll!CWnd::OnWndMsg(unsigned int message=273, unsigned int wParam=1, long
mfc71d.dll!CWnd::WindowProc(unsigned int message=273, unsigned int wParam=1, long
mfc71d.dll!AfxCallWndProc(CWnd * pWnd=0x0012fe3c, HWND__ * hWnd=0x0028016e, unsigned int
mfc71d.dll!AfxWndProc(HWND__ * hWnd=0x0028016e, unsigned int nMsg=273, unsigned int wParam=1,
mfc71d.dll!AfxWndProcBase(HWND__ * hWnd=0x0028016e, unsigned int nMsg=273, unsigned int
user32.dll!77d18734()
user32.dll!77d18816()
user32.dll!77d1b4c0()
user32.dll!77d1b89b()
user32.dll!77d1b903()
user32.dll!77d4fd1d()
user32.dll!77d46561()
user32.dll!77d26df4()
mfc71d.dll!AfxGetModuleThreadState() Line 243 C++
mfc71d.dll!AfxGetThread() Line 142 + 0x5 C++
//根本就没有在无限消息循环for (;;)里面
响应发送消息时程序怎么就跳出了无限消息循环for (;;),怎么回事呀?