Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP.exe to different VFP.exe
Message
From
12/02/2021 16:20:17
 
 
To
12/02/2021 14:54:01
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01678195
Message ID:
01678197
Views:
86
>Hey all
>
>I am trying to have a launcher find a running vfp.exe (call it target.exe) and switch to it, if it has the right startup folder. If not, I want to launch that one. I can find examples to get the target exe by window title. That won't work as the app changes the title frequently.
>
>I think I want to access the _docmd of the target.exe so I can check if it is the correct target.
>
>So I want to iterate through all running targets, but check their startup folder. If none are running, or not the one for this particular folder, then I want to start them. I already have the way to start them with shellexecute.

Mike,

You can get information about a process from the Win32_Process class.

Using Marco Plaza's WMIQuery little gem:
LOCAL Processes AS Object
LOCAL Process AS Object

m.Processes = WMIQuery("Win32_Process")

FOR EACH m.Process IN m.Processes.Items

	IF m.Process.Name == "vfp9.exe"
		? "VFP9 is running at", m.Process.ExecutablePath
		EXIT
	ENDIF

ENDFOR
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform