I write a project with visual studio. In the project I build a class called CSimApplianceDlg which has two members:
static UINT RecvDataFrame(LPVOID pParam)
and CSerialPort m_Port
class CSimApplianceDlg : public CDialog
{
// Construction
public:
CSimApplianceDlg(CWnd* pParent = NULL); // standard constructor
// Implementation
protected:
HICON m_hIcon;
// Added for Serial Port operation
static UINT RecvDataFrame(LPVOID pParam); // Process received data
......
private:
......
unsigned char m_SendData[MAX_LEN]; // Data to be sent
int len; // the length of data to be sent
public:
CSerialPort m_Port; // CSerialPort Object
......
CSerialPort
has a public member function WriteToPort
to send data through serial port.
public:
void WriteToPort(char* string);
void WriteToPort(char* string,int n);
void WriteToPort(LPCTSTR string);
void WriteToPort(LPCTSTR string,int n);
I called
m_Port.WriteToPort(m_SendData,len);
in UINT CSimApplianceDlg::RecvDataFrame(LPVOID pParam). However, while building the project, just at the line of the calling, I got
1>e:\mysourcecode\smarthome\simappliance\simappliance\simappliancedlg.cpp(557) : error C2228: left of '.WriteToPort' must have class/struct/union
1>e:\mysourcecode\smarthome\simappliance\simappliance\simappliancedlg.cpp(557) : error C2597: illegal reference to non-static member 'CSimApplianceDlg::m_SendData'
1>e:\mysourcecode\smarthome\simappliance\simappliance\simappliancedlg.cpp(557) : error C2597: illegal reference to non-static member 'CSimApplianceDlg::len'
How can I deal with these errors? And which WriteToPort
is called, because I
am not familiar with LPCTSTR
.