如何将MSCOMMCtrl事件路由到线程 [英] How to route MSCOMMCtrl event to a thread

查看:63
本文介绍了如何将MSCOMMCtrl事件路由到线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MSCOMMctrl进行串行通信。我可以使用EVENT SINK机制向MainFrame.cpp获取事件通知。



现在我想把它转到我的沟通线程。我为CWinThread派生了一个CCommThread类。



我将事件接收器编码如下。



BEGIN_EVENTSINK_MAP(CCommThread,CWinThread)

ON_EVENT(CCommThread,ID_COMMCTRL,1 / * OnComm * /,OnComEvent,VTS_NONE)

END_EVENTSINK_MAP()



编译没关系但是没有将事件通知发送给骚扰者。



我做错了什么?



感谢您的任何建议/意见



使用VC ++ 6.0

解决方案

从CCommThread而不是UI线程创建控件。



(我同意Jochen - Active X控件很古老。)

I am using MSCOMMctrl for serial communication. I am able to get the event notification to the MainFrame.cpp using the EVENT SINK mechanism.

Now I want to get this to my communication thread. I have derived a CCommThread class for CWinThread.

I coded the event sink as follows .

BEGIN_EVENTSINK_MAP(CCommThread,CWinThread)
ON_EVENT(CCommThread, ID_COMMCTRL, 1 /* OnComm */, OnComEvent, VTS_NONE)
END_EVENTSINK_MAP()

The compilation is OK. But not getting the event notification to the thraed.

What I am doing wrong ?

Thanks for any suggestion / advice

Using VC++ 6.0

解决方案

Create the control from your CCommThread instead of the UI thread.

(I agree with Jochen - that Active X control is ancient.)


这篇关于如何将MSCOMMCtrl事件路由到线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆