Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Send Key Strokes to an APP not VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00470543
Message ID:
00470568
Vues:
33
>I was wondering how I could send some keys to another windows application from a VFP application
>
>In this example Test App is the title of the application and it is not a VFP app.
>
>So far I tried...
>
>tcWindow="Test App"
>DECLARE INTEGER FindWindow IN Win32API STRING, STRING
>DECLARE INTEGER SetForegroundWindow IN "User32.dll" INTEGER
>HWND = FindWindow(0,tcWindow)
>=SetForegroundWindow(HWND)
>INKEY(3)
>
>KEYBOARD("1")
>
>
>This merely activates the program but the keys go into the vfp app.
>
>Maybe there is some API call's I can use?
>
>Thanks

Depends on the keystrokes, but here's a short sample from the second artricle in the Windows Script Host series that Ed Rauh and I have written. The series began in Sept. of last year.
* Create the Shell reference
oShell = CREATEOBJECT("WScript.Shell")
DECLARE Sleep IN Win32API;
    INTEGER dwMilliseconds
oShell.Run("Notepad")
oShell.AppActivate("Untitled – Notepad")
= Sleep(100) && Pause VFP for a 1/10 of a second 
oShell.SendKeys("This sends a sentence to Notepad from VFP.~")
Naturally, this requires that the WSH be installed. You can find the articles on-line at www.vfug.org
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform