Hello all,
I would like to use the new SerialPort class in Visual C++ 2005
Express edition, but I am having problems adding my event handler to
the DataReceived event. In the header file I have the method that will
handle the event defined as
private: void SerialPortRecei ve_EventHandler ( System::Object ^ sender,
System::IO::Por ts::SerialDataR eceivedEventArg s^ e );
In the cpp file the function is declared as
void CCommLayer::Ser ialPortReceive_ EventHandler( System::Object^
sender, System::IO::Por ts::SerialDataR eceivedEventArg s^ e )
{
// Perform task here.
}
In the cpp file when the SerialPort is instantiated the following line
adds the method to the event delegate...
m_SerialPortCon->DataReceived += gcnew SerialDataRecei vedEventHandler (
&CCommLayer::Se rialPortReceive _EventHandler );
When I compile it I get the following error, but I don't know why..
..\CCommLayer.c pp(95) : error C3352: 'void
SDU::Comm::CCom mLayer::SerialP ortReceive_Even tHandler(System ::Object
^,System::IO::P orts::SerialDat aReceivedEventA rgs ^)' : the specified
function does not match the delegate type 'void (System::Object
^,System::IO::P orts::SerialDat aReceivedEventA rgs ^)'
Any help is greatly appreciated... thanks
Mark
I would like to use the new SerialPort class in Visual C++ 2005
Express edition, but I am having problems adding my event handler to
the DataReceived event. In the header file I have the method that will
handle the event defined as
private: void SerialPortRecei ve_EventHandler ( System::Object ^ sender,
System::IO::Por ts::SerialDataR eceivedEventArg s^ e );
In the cpp file the function is declared as
void CCommLayer::Ser ialPortReceive_ EventHandler( System::Object^
sender, System::IO::Por ts::SerialDataR eceivedEventArg s^ e )
{
// Perform task here.
}
In the cpp file when the SerialPort is instantiated the following line
adds the method to the event delegate...
m_SerialPortCon->DataReceived += gcnew SerialDataRecei vedEventHandler (
&CCommLayer::Se rialPortReceive _EventHandler );
When I compile it I get the following error, but I don't know why..
..\CCommLayer.c pp(95) : error C3352: 'void
SDU::Comm::CCom mLayer::SerialP ortReceive_Even tHandler(System ::Object
^,System::IO::P orts::SerialDat aReceivedEventA rgs ^)' : the specified
function does not match the delegate type 'void (System::Object
^,System::IO::P orts::SerialDat aReceivedEventA rgs ^)'
Any help is greatly appreciated... thanks
Mark