Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Killing a DOS FTP window
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Versions des environnements
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00969520
Message ID:
00969581
Vues:
13
Patrick,

The command get a reference to WMI Object, so, you can use the Object's properties and methods. (WMI stands for Windows Management Instrumentation, you can read an introduction about it here http://www.microsoft.com/whdc/system/pnppwr/wmi/default.mspx)

It can be simplified to just GetObject("winmgmts:"), for the rest are usually the default values.

If you can not get the process ID, take a look at the second example, which uses the exe name (FTP.EXE in your case?, not sure)
loWMI		= GetObject("winmgmts:")
loProcesses	= loWMI.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'FTP.EXE'")
For Each objProcess in loProcesses
	objProcess.Terminate(0)
Next
Warning, this will end ALL instances of FTP.EXE if you have more than one running concurrently (and without the Process ID, you would not know which one to kill anyways)

Oh! I just realized you are using VFP 7, so it might be possible that loWMI = GetObject("winmgmts:") does not work (I do not remember, and I do not have it to test), if it does not work, try replacing it with this two lines:
    loWBEMLocator = Createobject("wbemScripting.SwbemLocator")
    loWMIService = loWBEMLocator.ConnectServer()
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform