Got it.
I'm trying not to use the DO WHILE loop cause it will swallow the server's resources while waiting for the SMTP server to respond to my winsock control.
I do have to say that I tried READ EVENTS the first time because I thought the DataArrival event was considered a system event not coming from the UI.
Anyway there has to be a way to use event driven programming inside a COM dll.
I really hope I just haven't found the way to do it and not that the problem is that there simply isn't a way to use an event driven architecture in a COM dll.
I was wondering, if instead of a dll I made an out of process .exe, can I use READ EVENTS? Gonna try it right now.
Thanks!
>A timer won't work, unless you want to jump out of the COM process, and let the client poll the COM server for the results after they are ready.
>
>The reason a timer works like this, is that a timer's timer event comes in at it's own root of the call stack: other events and methods that come after a READ EVENTS are initiated by a UI event. So a timer's event wil not keep the processing control in the server.
>
>When I said poll, I really meant in a loop (DO WHILE).
>
>>Hi Erik:
>>
>> Tried something like that.
>> I put a timer in the class hoping that it would keep VFP6r running while
>> the winsock control talked to the SMTP server. In the timer event I checkd for CR/LF in the data received, signaling the end of that response.
>>
>>MAILER.START_PROCESS
>> THIS.TIMER.INTERVAL = 100
>> THIS.CHECK_FLAG = .T.
>>
>>TIMER.INTERVAL
>> IF THISFORM.CHECK_FLAG
>> IF (CHR(13) + CHR(10)) $ THISFORM.RECEIVED_DATA
>> THISFORM.CHECK_FLAG = .F.
>> THISFORM.PROCESS_DATA()
>> ENDIF
>> ENDIF
>>
>>MAILER.PROCESS_DATA
>> PROCESS.....
>> ...........
>> THIS.CHECK_FLAG = .T.
>>
>> As you can see the timer is active at all times but it still jumpes out
>> exactly at the same place.
>>
>>This project is 99% complete, obviously this is the only missing part.
>>Any more ideas?
>>
>>TIA
>>
>>>>Hi:
>>>>
>>>> I made a class based on form that has a MSWinsock control in it.
>>>> Using the winsock control I connect to a SMTP server to send emails.
>>>> It worked flawlessly until I tried to use it in a COM dll.
>>>>
>>>>
>>>>I tried to use READ EVENTS but READ EVENTS does not seem to work
>>>>inside the COM dll.
>>>>
>>>
>>>READ EVENTS is the command that tells VFP to go into a wait state ready for USER input. It relays processing control to the UI. VFP COM dll cannot have a UI. The Vfp6r.dll (the VFP runtime for single threaded COM servers) probably responds to a READ EVENTS by jumping out of the method, because a REASD EVENTS doesn't belong in a COM dll.
>>>
>>>If you want your COM server to wait and poll Winsock, just put in in a loop that checks the ready status of the WinSock control.
R. Davila
DBA / Network Administrator
Administracion de Fomento Comercial
Gobierno de Puerto Rico
Still waiting for FoxPro for LINUX