关于界面销毁的讨论
大家先看看这个贴。http://bbs.csdn.net/topics/390898180
后来我在MSDN看到EndDialog 明确提到不是立即销毁,DestroyWindow 是发消息,意思也是会等一段时间。
今天,我又遇到了一种情况,应该是和上述现象本质原因是一样的。还是在一个DLL库中显示不同的DLG,用于不同的信息提示,有模态,有非模态。具体现象是:
模态显示一个对话框A的时候(DialogBoxParam调用,窗口函数中通过EndDialog 销毁),第二次调用DialogBoxParam很大概率出错,直接返回-1,LastError是183(错误意义是:当文件已存在时,无法创建该文件)
我个人的感觉就是第一次DialogBoxParam对话框A的时候,调用EndDialog 销毁,系统实际还没有销毁,然后第二次DialogBoxParam对话框A,就报错183了
关于这种现象,大家遇到过吗,有解决方法吗?
以下是MSDN解释。
EndDialog does not destroy the dialog box immediately. Instead, it sets a flag and allows the dialog box procedure to return control to the system. The system checks the flag before attempting to retrieve the next message from the application queue. If the flag is set, the system ends the message loop, destroys the dialog box, and uses the value in nResult as the return value from the function that created the dialog box.
The DestroyWindow function destroys the specified window. The function sends WM_DESTROY and WM_NCDESTROY messages to the window to deactivate it and remove the keyboard focus from it. The function also destroys the window's menu, flushes the thread message queue, destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window is at the top of the viewer chain).
后来我在MSDN看到EndDialog 明确提到不是立即销毁,DestroyWindow 是发消息,意思也是会等一段时间。
今天,我又遇到了一种情况,应该是和上述现象本质原因是一样的。还是在一个DLL库中显示不同的DLG,用于不同的信息提示,有模态,有非模态。具体现象是:
模态显示一个对话框A的时候(DialogBoxParam调用,窗口函数中通过EndDialog 销毁),第二次调用DialogBoxParam很大概率出错,直接返回-1,LastError是183(错误意义是:当文件已存在时,无法创建该文件)
我个人的感觉就是第一次DialogBoxParam对话框A的时候,调用EndDialog 销毁,系统实际还没有销毁,然后第二次DialogBoxParam对话框A,就报错183了
关于这种现象,大家遇到过吗,有解决方法吗?
以下是MSDN解释。
EndDialog does not destroy the dialog box immediately. Instead, it sets a flag and allows the dialog box procedure to return control to the system. The system checks the flag before attempting to retrieve the next message from the application queue. If the flag is set, the system ends the message loop, destroys the dialog box, and uses the value in nResult as the return value from the function that created the dialog box.
The DestroyWindow function destroys the specified window. The function sends WM_DESTROY and WM_NCDESTROY messages to the window to deactivate it and remove the keyboard focus from it. The function also destroys the window's menu, flushes the thread message queue, destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window is at the top of the viewer chain).
...全文
相关推荐
View拖动、碰撞、销毁、爆炸效果
让View变得可自由拖动,实现View的碰撞判断、碰撞之后销毁、粒子爆炸动画等效果
易语言-易语言API创建时钟方法与销毁时钟方法
易语言API创建时钟方法与销毁时钟创建时钟方法源码
MFC.rar_MFC 销毁窗口_mfc non client_mfc 创建窗口
讲述: 怎样应用MFC创建销毁一个窗口,使用AfxRegisterWndClass ()函数注册一个窗口类,基类及消息处理机制
swiftui:SwiftUI讨论论坛
SwiftUI讨论 只是讨论SwiftUI事物的地方。 这是官方的开放替代方案,我个人认为这不是很好。 对于仅限Swift的问题,请使用官方的。
Android 保存Fragment 切换状态实例代码
前言 一般频繁切换Fragment会导致频繁的释放和创建,如果Fragment比较臃肿体验就非常不好了,这里分享一个方法。 正文 一、应用场景 1、不使用ViewPager 2、不能用replace来切换Fragment,会导致Fragment释放(调用onDestroyView) 二、实现 1、xml <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=matc


界面
