postquitmessage(PostQuitMessage的参数有什么用)
本文目录
PostQuitMessage的参数有什么用
作为整个程序的返回值,供父进程可以检查用。 while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0) { if (bRet == -1) { // handle the error and possibly exit } else { TranslateMessage(&msg); DispatchMessage(&msg); } } // 这里返回给系统 return msg.wParam;
PostQuitMessage(0);不能退出程序啊
把GetMessage(&msg,hwnd,0,0)改成GetMessage(&msg, NULL, 0, 0); 如果不改, 当窗口被Destroy后, 再调用GetMessage会导致返回值为-1, 成了死循环 参见msdn If there is an error, the return value is -1. For example, the function fails if hWnd is an invalid window handle or lpMsg is an invalid pointer. To get extended error information, call GetLastError.Warning Because the return value can be nonzero, zero, or -1, avoid code like this:while (GetMessage( lpMsg, hWnd, 0, 0)) ... The possibility of a -1 return value means that such code can lead to fatal application errors. Instead, use code like this:BOOL bRet;while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0){ if (bRet == -1) { // handle the error and possibly exit } else { TranslateMessage(&msg); DispatchMessage(&msg); }}
更多文章:

html网站首页代码(如何查找网站首页HTML代码<head></head>)
2025年2月20日 03:20

网站源码与SEO有什么关系?找网络公司、站长必备源码到哪里推荐一下
2025年2月26日 18:20

of course的用法(关于Of course的使用场合~~)
2025年2月24日 02:00

tablelayout(VB.NET中如何向TableLayoutPanel控件指定行和列写数据)
2025年3月24日 16:30

git通俗一点是干什么的(到底什么是ssh和git, 通俗的讲解下, 一定要通俗形象, 一下就明白, 不要扯太多专业术语,)
2025年3月2日 15:40

nonetheless是什么意思(nevertheless是什么意思)
2025年3月4日 23:50

constant手表(frederique constant geneve手表FREDERIQUECONSTANTGEN)
2025年2月13日 14:30