Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to make application active after RUN /N7 (bug?)
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01033827
Message ID:
01033845
Views:
17
This message has been marked as the solution to the initial question of the thread.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform