>>Sorry for the delay, but what window handle are you passing? VFP has a number of them (I think when you start in design mode it's something like 6 or 7). I've come to the conclusion, but haven't tested yet, that the key here is to call the form's Activate event prior to issuing the READ EVENTS. Have you tried that?
>
>As for the application which only contains one form which is top level, it's solved.
>
>The problem remains for another application which loads the desktop. In that case, I don't have the focus on the desktop. Basically, it's like as if I wouldn't be in Visual FoxPro. Any idea?
Michel,
Remember that Windows is a pre-emptive multi-tasking operating system. IOW, whether or not an application has focus, it still gets a time-slice of the processor and processing continues. If this is VFP 7.0, just past the _VFP.hWnd property to the same API function as in the other case. If pre-7.0, use either the FindWindow() API call passing the _SCREEN.Caption property to get the window handle or MainhWnd() from Foxtools.
George
Ubi caritas et amor, deus ibi est