简体   繁体   English

如何知道MFC消息循环是否已在运行?

[英]How to know if a MFC message loop is already running?

Is there any way to know whether a MFC message loop is already running? 有什么方法可以知道MFC消息循环是否已经在运行吗?

EDIT : Context: A library (with event handling) needs to know whether its event filtering has to attach to an existing MFC message loop or create its own message loop: in case a main message loop already exists it must not create its own loop because it would be blocking. 编辑 :上下文:一个库(具有事件处理)需要知道其事件筛选是否必须附加到现有的MFC消息循环或创建自己的消息循环:万一主消息循环已经存在,它一定不能创建自己的循环,因为它会阻塞。

There is no way to do it without waiting some time, for instance while trying to send an event and wait for it, or wait 5 sec using a special MFC function which is dedicated to detect stalled applications (which one? I can't remember its name...). 没有等待时间是无法做到的,例如,尝试发送事件并等待它,或者使用专用于检测停顿的应用程序的特殊MFC函数等待5秒钟(哪一个?我不记得了)其名称...)。

If you need to do it, find another way, make other assumptions. 如果您需要这样做,请寻找另一种方法,并进行其他假设。 Sorry. 抱歉。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM