Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 19-Apr-15 10:06am
v2
Comments
Jochen Arndt 20-Apr-15 3:13am    
I don't know how to solve your problem.

But using the MSCOMM32 OCX control for serial communication is an outdated technology. It must be also installed on the client machine.

I suggest to just use the Windows API functions for serial communication using a worker thread calling SetCommMask and WaitCommEvent to get notifications upon serial port activity.

1 solution

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

(I agree with Jochen - that Active X control is ancient.)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900