您的位置:首页 > 其它

发现原来使用BOOL类型返回值的函数都是三值逻辑

2008-08-22 10:12 288 查看
BOOL是微软定义的typedef int BOOL。与bool不同,它是一个三值逻辑,TRUE/FALSE/ERROR,返回值为>0的整数为TRUE,0为FALSE,-1为ERROR。

Win32 API中很多返回值为BOOL的函数都是三值逻辑。比如GetMessage:[/b]
BOOL GetMessage(
  LPMSG lpMsg[/b],                    // message information[/b]
  HWND hWnd[/b],                     // handle to window[/b]
  UINT wMsgFilterMin[/b],                         // first message[/b]
  UINT wMsgFilterMax[/b]                         // last message[/b]
);[/b]

If the function retrieves a message other than WM_QUIT, the return value is nonzero.[/b]
If the function retrieves the WM_QUIT message, the return value is zero. [/b]
If there is an error, the return value is -1.[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐