>I am working on a web page that uses a created VFP .dll. I need to put a pause in the .dll while it waits for a file. I have set up a do while statment until it returns which sends the utilization up to 100%. I've tryed using a timer, but the time doesn't seem to fire in the page. Has anyone experienced similar problems?
>
VFP in-process COM servers can't have any UI, and tiemrs qualify as UI. Your best bet would probably be to use the Win32 API cll Sleep(). I haven't tried this in a .DLL, but it'd look like:
DECLARE Sleep IN Win32API INTEGER dwMilliseconds
=Sleep(1000) && wait 1 second = 1000ms
Depending on exactly what's happening, other API calls may be more desirable - the caveats for the Sleep() call from the MSDN are:
Remarks
A thread can relinquish the remainder of its time slice by calling this function with a sleep time of zero milliseconds.
You have to be careful when using Sleep and code that directly or indirectly creates windows. If a thread creates any windows, it must process messages. Message broadcasts are sent to all windows in the system. If you have a thread that uses Sleep with infinite delay, the system will deadlock. Two examples of code that indirectly creates windows are DDE and COM CoInitialize. Therefore, if you have a thread that creates windows, use MsgWaitForMultipleObjects or MsgWaitForMultipleObjectsEx, rather than Sleep.
MAPI: For more information, see Syntax and Limitations for Win32 Functions Useful in MAPI Development.
If you're waiting for a process you've launched to complete, you may want to look at using CreateProcess() to launch it and then monitor it's completion; look at my API_APPRUN class for examples of how this might be used.