I'm going to take a wild guess and say that you are running into the change that came about in Windows 2000 that changed the way that SetForegroundWindow operates. I wrote a FAQ about this over in the Tek-Tips Forum. Here's the link...
http://www.tek-tips.com/faqs.cfm?fid=4262>To reproduce:
>
>1. Make sure that charmap.exe (or any other application executed by run /N) is in path.
>
>2. Create test.exe from the code below
>
>
BUILD PROJECT test FROM TEST
>BUILD EXE test FROM test
>QUIT
>
>3. Run test.exe outside VFP
>
>4. Press some character keys in keyboard
>
>Observed result:
>
>pressed keys are not echoed in screen
>
>Expected result:
>
>pressed keys must be echoed in screen
>
>Platforms: VFP 7, VFP 9 in XP SP2
>
>Any idea how to get expected result ?
>
>
RUN /N7 charmap.exe
>DECLARE SHORT SetForegroundWindow IN USER32.DLL INTEGER hWnd
>SetForegroundWindow(_screen.HWnd)
>ACTIVATE SCREEN
>CLEAR
>SET TALK OFF
>SET ECHO OFF
>? 'Press keyboard keys to test foreground state'
>?
>DO WHILE .t.
> nres = INKEY()
> IF nres=27
> EXIT
> ENDIF
>
> IF nres#0
> ??CHR(nres)
> ENDIF
>ENDDO