You cannot create a stream using a non-static member of a function as a stream procedure: the reason is that all non-static methods of the class have an implicit first argument, this is a pointer to this.
it
class foo { void dosomething(); };
actually
class foo { void dosomething(foo* this); };
Because of this, the function signature does not match the one you need for the stream procedure. You can use the static method as a stream procedure and pass it to this pointer. Here is an example:
class foo { CWindThread* m_pThread; HANDLE hSerial; static UINT MyThreadProc(LPVOID pData); void Start(); }; void foo::Start() { m_pThread=AfxBeginThread(MyThreadProc,(LPVOID)this); } UINT foo::MyThreadProc(LPVOID pData) { foo* self = (foo*)pData;
source share