为什么去掉静态成员函数里的static,后面就报错?
temp 2001-05-07 03:01:00 将原来的
static UINT CommThread(LPVOID pParam);
static void ReceiveChar(CSerialPort* port, COMSTAT comstat);
static void WriteChar(CSerialPort* port);
CWinThread* m_Thread;
...
改为:
UINT CommThread(LPVOID pParam);
void ReceiveChar(CSerialPort* port, COMSTAT comstat);
void WriteChar(CSerialPort* port);
CWinThread* m_Thread;
...
就报错,加上static就没错了。
E:\testado2\SerialPort.cpp(457) : error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'unsigned int (void *)'
相关代码:
BOOL CSerialPort::StartMonitoring()
{
if (!(m_Thread = AfxBeginThread(CommThread, this)))
return FALSE;
TRACE("Thread started\n");
return TRUE;
}
UINT CSerialPort::CommThread(LPVOID pParam)
{
... ...
}