Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP.exe to different VFP.exe
Message
De
17/02/2021 13:16:34
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
16/02/2021 17:23:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01678195
Message ID:
01678336
Vues:
63
>>I was able to reduce the number of items to check by adding the legacy name to the query.
>>SELECT * FROM Win32_Process WHERE Name = 'legacyapp.exe'
>>
>>I altered the loop to see which ExecutablePath each instance of the legacy app has.
>>IF upper(m.Process.Name) == "LEGACYAPP.EXE" and 'somefolder'$m.Process.ExecutablePath
>>
>>Very good!
>>
>>Now to make that application come to the foreground. Any suggestions? Is m.Process.Handle the hWnd? Why is it the same as m.Process.ProcessID?
>>
>
>Mike, once you have the process ID, I think you can get the hWnd of its _Screen that you can move to foreground. I haven't tried this, but hopefully it's workable.
>
>You'll need VFP2C32.fll to get the required information from the system. The library is available from https://github.com/ChristianEhlscheid/vfp2c32.
>
>After the library is loaded, create an array of top level windows:
>
>
>#include "vfp2c.h"
>
>DIMENSION hWnds[1, 2]
>AWindowsEx('hWnds', 'WO', AWINDOWS_TOPLEVEL)
>
>
>Now, you'll have an array of top level windows for the processes running in your system. The first column holds a hWnd, the second the process id (I think...).
>
>Go trough the array and locate the process you got from the WMI_Query. Fetch the corresponding hWnd, and send the window to the foreground.
>
>Let us know if it works...

Mr. Lopes

I've very close to my goal. Your assistance was excellent. Marco's work helped too. I combined a few things and found a combination that works, so that I at least get hWnd, Pid, exe file name and ExecutablePath. I admit it's a guess that AWindowsEx does not include the path. If I'm wrong on that, please let me know.

Beyond that, I would much rather create a cursor than an array because Fox gives so many ways to iterate through a cursor.

So far, the launcher can switch to the existing app or launch one. I am playing with hiding the executing icon, so the only icon visible is the launcher. I got it to hide the executable, but can't get it to show, so I can switch to it.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform