Madix_t


Good day to all

How could i close an open program (ex. word, excel or any open program) from VFP

thank you very much for any help





Re: how could i close a program with-in VFP?

MarciaAkins


Madix_t wrote:

How could i close an open program (ex. word, excel or any open program) from VFP
thank you very much for any help

Is this a program that you have instantiated from VFP using automation and code like this:

loWord = CREATEOBJECT( [Word.Application] )

If so, all you need to do is this:

loWord.Quit( .F. )







Re: how could i close a program with-in VFP?

CetinBasoz

You can use TermiateProcess winapi call.




Re: how could i close a program with-in VFP?

Madix_t

no i did not use CREATEOBJECT, i have a monitoring application in a workstation that is remotely manage at the server, and i wanted to enhance the feature by adding a code for closing down another application in that particular workstation, like word applic. excel, or if it possible, a games.

thank you






Re: how could i close a program with-in VFP?

ionutp

You can use "pskill.exe" (you will find it at Microsoft and it's free)



Re: how could i close a program with-in VFP?

Naomi Nosonovsky

If you know the name of the process, you may also use

Code Snippet
loCIMV2 = GetObject("winmgmts://localhost/root/cimv2")
loProcesses = loCimv2.ExecQuery("SELECT * FROM Win32_Process WHERE Name LIKE 'vfp%'")
For Each objProcess in loProcesses
objProcess.Terminate(0)
Next

In this sample I kill all opened VFP instances.