OK, I have this little problem. I am writing a VB.Net COM to retrieve email from a mail server. Every thing work fine except when the main application (Using the new COM) askes for some information from the mail server.
Here is the situation:
Main application calls a function in the Email COM.
The Email COM asks the mail server.
The Email COM then has to wait for a response before the function can exit. I have a thread that waits for this reponse and populates a variable with the returned data.
The main function has to detect this imcoming data and responsed.
Now here the problem. How can I get the function to wait around and give the background thread a chance to accept the incoming data. In VB6 I would noramlly use a DoEvents in a while loop but this process is no longer valid.
Public Function GetMessagesList() As cMailList
'Sends the request to the mail server
Me.SendString("list"
'Now has to wait for the response from the mail
'server so it can process the returned string
'and put it in the custom cMailList object.
While Not aMailResponse.EndsWith("." & vbCrLf)
'This is where I need the function to give the
'background thread time to retrieve the incoming data
DoEvents
End While
End Function
Some idea about this would be helpful. Remember this is a COM so I cant use the application.doevents or form.doevents.
AGIMA where professional web hosting is our business.
AGIMA Computing
Here is the situation:
Main application calls a function in the Email COM.
The Email COM asks the mail server.
The Email COM then has to wait for a response before the function can exit. I have a thread that waits for this reponse and populates a variable with the returned data.
The main function has to detect this imcoming data and responsed.
Now here the problem. How can I get the function to wait around and give the background thread a chance to accept the incoming data. In VB6 I would noramlly use a DoEvents in a while loop but this process is no longer valid.
Public Function GetMessagesList() As cMailList
'Sends the request to the mail server
Me.SendString("list"
'Now has to wait for the response from the mail
'server so it can process the returned string
'and put it in the custom cMailList object.
While Not aMailResponse.EndsWith("." & vbCrLf)
'This is where I need the function to give the
'background thread time to retrieve the incoming data
DoEvents
End While
End Function
Some idea about this would be helpful. Remember this is a COM so I cant use the application.doevents or form.doevents.
AGIMA where professional web hosting is our business.
AGIMA Computing