If you put in Sleep(0), it will wait efficiently and allow other things to process. I've found this to be the best way to do it in a .VFP. mtdll...
>I have a Web Service that I want to send SMTP e-mail. I have a program that uses the winsock control to send SMTP e-mail and I want to use that in the webservice.
>
>The problem is I need my Web Service to stop and wait until the winsock control is finished. Since the winsock needs to connect then wait fot the connect then send information and wait for the respons. So I need to put in a loop to see when I'm finished. I tried
>
>
>DO WHILE oWinsock.State <> 7
> DOEVENTS
>ENDDO
>
>
>That worked but it still eats up a lot of the CPU. Is there a better way to wait? I was thinking DOEVENTS FORCE but if the machine is not logged in I don't know if that will just hang the machine. I also don't want to use the Sleep API because that seems to stop the winsock sending and receiving information as well as the Web Service. Any ideas?