Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Start and Stop Services
Message
De
21/07/2015 12:48:05
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01622286
Message ID:
01622344
Vues:
52
>>>Hi Gang!
>>>
>>>How do you go about turning a service OFF in VFP ( by using code ). And.... turn a Service back On ???
>>
>>If you can use a CMD window, you can use the NET START/STOP etc. commands: https://technet.microsoft.com/en-us/library/cc736564%28v=ws.10%29.aspx
>>
>>Without having to shell out to a CMD window, the best bet might be WMI. I believe there are users here experienced with using WMI from VFP. Here's a Google result that uses VBScript, the calls are probably translatable to VFP: http://www.computerperformance.co.uk/vbscript/wmi_services.htm
>>
>>Any method you end up using will require elevated privileges to run on current versions of Windows.
>
>You saying that as they run the program, everytime that the service is shut down or started, they will have the permissions popup stop them to ask permission to continue ?

Your program has to have sufficient privileges to start/stop services. The account you run it under, by default, may not. In that case you may have to provide credentials (user name/password) for an account that has enough privileges (e.g. local administrator account). This may be referred to as "impersonation" in things like function parameters, object properties etc.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform