Win7, message queue size = 10000, post a message to a full queue will result GetLastError() = 1816 (Not enough quota is available to process this command.)
// srouce code
BEGIN_MESSAGE_MAP(Cmfc1Dlg, CDialogEx)
ON_MESSAGE(WM_MY_MSG, &Cmfc1Dlg::OnMyMsg)
END_MESSAGE_MAP()
LRESULT Cmfc1Dlg::OnMyMsg(WPARAM wParam, LPARAM lParam)
{
TRACE("get msg %d/n", (int)wParam);
//block all the upcomming messages in the message queue
while(1);
return 0;
}
void Cmfc1Dlg::OnBnClickedButton1()
{
for(int i = 1; i <= 100000; i++)
{
if(!PostMessage(WM_MY_MSG, (WPARAM)i, 0))
{
TRACE("post fail i = %d, last error = %d/n", i, GetLastError());
break;
}
}
}
figure out windows message queue size
最新推荐文章于 2026-06-23 13:39:58 发布
本文探讨了在Windows 7系统中消息队列大小限制为10000时,尝试向已满的消息队列发送消息所导致的问题及错误代码1816,并通过示例代码展示了如何复现这一情况。

1397

被折叠的 条评论
为什么被折叠?



