首页 > Windows开发 > 详细

DestroyWindow函数注意事项

时间:2015-04-07 23:09:15      阅读:331      评论:0      收藏:0      [点我收藏+]

最近遇到这样一个问题:将一个窗口句柄以参数的形式传递给一个线程,在线程中使用完之后要将窗口销毁,调用DestroyWindow销毁窗口是返回false,GetLastError的结果为5:拒绝访问,而在线程外则是可以销毁的。

查阅msdn,解释如下:

A thread cannot use DestroyWindow to destroy a window created by a different thread.

 

此外,还有以下需要注意的点:

If the specified window is a parent or owner window, DestroyWindow automatically destroys the associated child or owned windows when it destroys the parent or owner window. The function first destroys child or owned windows, and then it destroys the parent or owner window.

 

If the window being destroyed is a child window that does not have the WS_EX_NOPARENTNOTIFY style, a WM_PARENTNOTIFY message is sent to the parent.

 

更多信息详见msdn:https://msdn.microsoft.com/en-us/library/ms632682.aspx

 

DestroyWindow函数注意事项

原文:http://www.cnblogs.com/mhscn/p/4399893.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!