Click to See Complete Forum and Search --> : About CAsynSocket


Silicon Atom
April 20th, 1999, 10:28 AM
hi All?

I design a 'CPopSocket' class derived form CAsynSocket. I make following code .


CPopSocket * m_pPopSocket = new CPopSocket;
m_pPopSocket->Create();
... ( some POP3 operation )

m_pPopSocket->AsyncSelect(0);
delete m_pPopSocket;

After deleting m_pPopSocket, I find that there is FD_READ message in message queue sometimes ( 1%).
because m_pPopSocket has been destory. program display a Error Message.
I .don't kown Where Error is in .

any halp need !

gvirdi
April 25th, 1999, 12:08 PM
Try clearing the message queue first. Use PeekMessage() to see if there are any messages, then use GetMessage() to remove it from the queue and DispatchMessage() to dispatch the message. When all requests have been handled, you can destroy the object. If you don't want the message to be handled you retreive the message ID from GetMessage() and skip that message.