CDialog - 来自MODELESS对话框的EndDialog?(CDialog - EndDialog from a MODELESS dialog?)
...因为CDialog对象的普通OnOk和OnCancel成员函数会调用EndDialog,所以请确保您的无模式对话框不会调用这些函数而是覆盖它们
由于
CDialog::OnOk
有效地调用CDialog::EndDialog
,该方法如下所示:void CDialog::EndDialog(int nResult) { ASSERT(::IsWindow(m_hWnd)); if (m_nFlags & (WF_MODALLOOP|WF_CONTINUEMODAL)) EndModalLoop(nResult); ::EndDialog(m_hWnd, nResult); }
我们还可以检查
::EndDialog
的文档再次“清楚”地说明:必须使用EndDialog函数销毁DialogBox,DialogBoxParam,DialogBoxIndirect和DialogBoxIndirectParam函数创建的对话框。 应用程序从对话框过程中调用EndDialog; 该功能不得用于任何其他目的。
然而,我有一个
CDialog
派生类,它具有默认行为wrt。OnOK
,当我使用非模态/无模式时, 似乎一切正常。即:*当我关闭(无模式)对话框时,它将从视图中关闭/删除。 *该应用程序不显示任何内存泄漏。 (MFC调试版)
所以呢? 我是否需要阻止
EndDialog
并自行调用DestroyWindow
?
注意:我知道文档和“网络”的内容。 只是我还没有找到为什么我需要以不同的方式做到这一点,这一类应该可用于无模式和模态模式,所以不必做任何不同的事情可能很方便。
The MS documentation (and others) "clearly" states:
... Because the normal OnOk and OnCancel member functions of a CDialog object would call EndDialog, make sure your modeless dialog box does not call those functions and instead overrides
Since
CDialog::OnOk
effectively callsCDialog::EndDialog
, and that method looks like:void CDialog::EndDialog(int nResult) { ASSERT(::IsWindow(m_hWnd)); if (m_nFlags & (WF_MODALLOOP|WF_CONTINUEMODAL)) EndModalLoop(nResult); ::EndDialog(m_hWnd, nResult); }
we can also check the docs for
::EndDialog
which again "clearly" state:Dialog boxes created by the DialogBox, DialogBoxParam, DialogBoxIndirect, and DialogBoxIndirectParam functions must be destroyed using the EndDialog function. An application calls EndDialog from within the dialog box procedure; the function must not be used for any other purpose.
Yet, I have a
CDialog
derived class that has it's default behavior wrt.OnOK
and seemingly everything is working when I use it non-modal / modeless.That is: * When I close the (modeless) dialog, it is closed/removed from view. * The application doesn't show any memory leaks. (MFC debug build)
So what? Do I need to prevent
EndDialog
and callDestroyWindow
myself or not?
Note: I know what the docs and "the web" says. It's just that I haven't yet found why I need to do it differently, and this one class should be usable for modeless and modal mode, so not having to do anything different might be handy.
原文:https://stackoverflow.com/questions/16359005
最满意答案
您是否尝试将它们添加到apache mime.types文件中? 当你这样做时一定要重启apache。
BTW,典型的位置类似于/ usr / local / apache / conf
我希望能帮助你。
保重。
Did you try adding them to the apache mime.types file? Be sure to restart apache when you do.
BTW, the typical location is something like /usr/local/apache/conf
I hope that helps you.
Take care.
相关问答
更多-
以不正确的MIME类型提供文件可能会打开安全漏洞。 这是一个高调的例子。 Serving files with an incorrect mime type can open up security holes. Here's a high profile example.
-
f4v的HTML5 MIME类型(HTML5 MIME type for f4v)[2022-12-28]
使用“video / x-f4v”为我解决了这个问题。 Using "video/x-f4v" solved it for me. -
我收到了相同的Chrome错误,因为我的doctype是DOCTYPE! 而不是!DOCTYPE。 与其他浏览器相比,Chrome在解析HTML方面可能更加严格; 尝试将您的代码粘贴到http://validator.w3.org 。 或者也许在.htaccess文件中单独尝试以下行。 AddType text/cache-manifest appcache manifest 为了便于测试,只要刷新http://www.matthewlehner.ca,就刷新chrome:// appcache-inte ...
-
.mp4正确的MIME类型(Correct mime type for .mp4)[2022-12-22]
根据RFC 4337§2 , video/mp4确实是MPEG-4视频的正确内容类型。 通常,您可以通过搜索文件扩展名和“IETF”或“RFC”来查找官方MIME定义。 IETF(Internet Engineering Taskforce)发布的RFC(请求评论)文章定义了许多互联网标准,包括MIME类型。 According to RFC 4337 § 2, video/mp4 is indeed the correct Content-Type for MPEG-4 video. Generally, ... -
您是否尝试将它们添加到apache mime.types文件中? 当你这样做时一定要重启apache。 BTW,典型的位置类似于/ usr / local / apache / conf 我希望能帮助你。 保重。 Did you try adding them to the apache mime.types file? Be sure to restart apache when you do. BTW, the typical location is something like /usr/local/ ...
-
Html5视频和Flash方法(Html5 Video and Flash Approach)[2022-07-26]
这并不难。 您可以为单个 -
实际上,当您尝试在
-
你试过做HTML5循环标记吗?
-
通常,浏览器会根据元数据和传入流检测MIME类型,我相信他们甚至不再查看文件类型了。 您可以通过故意将实时网络服务器上的视频重命名为错误的扩展程序来看到此操作,浏览器和播放器通常仍会播放视频。 我能找到的关于这个主题的唯一参考来自一个教程网站 (html5 rock tutorials),引用: 在某些情况下,如果未正确设置MIME类型,浏览器将无法播放视频。 这是写于2010年,他们说“在某些情况下”。 不提供哑剧类型应该是安全的,尽管提供错误的可能会或可能不会导致它不播放。 Usually, brows ...
-
最后我解决了,补充道 AddType video/ogg .ogv AddType video/mp4 .mp4 AddType video/webm .webm 到.htaccess Finally I solved it, adding AddType video/ogg .ogv AddType video/mp4 .mp4 AddType video/webm .webm to .htaccess