首页 \ 问答 \ CDialog - 来自MODELESS对话框的EndDialog?(CDialog - EndDialog from a MODELESS dialog?)

CDialog - 来自MODELESS对话框的EndDialog?(CDialog - EndDialog from a MODELESS dialog?)

MS文档 (和其他 )“明确”陈述:

...因为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 calls CDialog::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. OnOKand 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 call DestroyWindow 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
更新时间:2022-08-09 12:08

最满意答案

您是否尝试将它们添加到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.
  • 使用“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 ...
  • 根据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/ ...
  • 这并不难。 您可以为单个
  • 实际上,当您尝试在元素中加载不支持的媒体类型时,将触发error事件。 然后,您可以监听这些事件,如果没有识别出任何来源,则触发回退: var sources = document.querySelectorAll('source'); var source_errors = 0; for (var i = 0; i < sources.length; i++) { sources[i].addEventListener('error', function(e) { if ...
  • 你试过做HTML5循环标记吗? 编辑:要从JavaScript中工作,请执行以下操作。 var video = document.createElement('video'); //To create the video element. video.loop = true; Have you tried doing the 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

相关文章

更多

最新问答

更多
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)
  • 是否可以嵌套hazelcast IMaps?(Is it possible to nest hazelcast IMaps? And whick side effects can I expect? Is it a good Idea anyway?)
  • UIViewAnimationOptionRepeat在两个动画之间暂停(UIViewAnimationOptionRepeat pausing in between two animations)
  • 在x-kendo-template中使用Razor查询(Using Razor query within x-kendo-template)
  • 在BeautifulSoup中替换文本而不转义(Replace text without escaping in BeautifulSoup)
  • 如何在存根或模拟不存在的方法时配置Rspec以引发错误?(How can I configure Rspec to raise error when stubbing or mocking non-existing methods?)
  • asp用javascript(asp with javascript)
  • “%()s”在sql查询中的含义是什么?(What does “%()s” means in sql query?)
  • 如何为其编辑的内容提供自定义UITableViewCell上下文?(How to give a custom UITableViewCell context of what it is editing?)
  • c ++十进制到二进制,然后使用操作,然后回到十进制(c++ Decimal to binary, then use operation, then back to decimal)
  • 以编程方式创建视频?(Create videos programmatically?)
  • 无法在BeautifulSoup中正确解析数据(Unable to parse data correctly in BeautifulSoup)
  • webform和mvc的区别 知乎
  • 如何使用wadl2java生成REST服务模板,其中POST / PUT方法具有参数?(How do you generate REST service template with wadl2java where POST/PUT methods have parameters?)
  • 我无法理解我的travis构建有什么问题(I am having trouble understanding what is wrong with my travis build)
  • iOS9 Scope Bar出现在Search Bar后面或旁边(iOS9 Scope Bar appears either behind or beside Search Bar)
  • 为什么开机慢上面还显示;Inetrnet,Explorer
  • 有关调用远程WCF服务的超时问题(Timeout Question about Invoking a Remote WCF Service)