Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Running VFP as a service
Message
De
15/07/2002 05:25:52
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00678539
Message ID:
00678610
Vues:
17
Geoff,

If you’re referring to the file I put in the download section, I think it’s best to rely on the start up parameter to install and uninstall the service. For other kinds of communication with the service you can use the sc.exe command line utility. If you want to pause the service you can run the command:
sc pause “vfp service”
If you want to resume, you can type:
sc continue “vfp service”
You can also send messages to the service, by using the sc control command. To test this, you can change the code to something like this:
PROCEDURE _IServiceEvents_Message(NUMBER AS NUMBER) AS VOID;
 HELPSTRING "Fires when a application-specific message arrives."
		* add user code here

	LOCAL;
	 lcFile

	lcFile = ADDBS(JUSTPATH(_VFP.Servername)) + SERVICE_NAME + "Message.txt"

	=STRTOFILE("Message: " + TRANSFORM(NUMBER) + CR_LF, lcFile, 1)

ENDPROC
Then, at the command prompt, you can send a message to the service (use numbers from 128 to 255 for custom messages):
sc control “vfp service” 130
You’ll see a new file in the exe folder named “Vfp serviceMessage.txt” with this line included:

Message: 130

It’ll be up to you how to interpret the different values. For other kinds of communication with the service, or if you want to store some values, it’s probably best to use the registry or just a plain dbf file. If you want more information about services, this article might help:
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/1097/winnt.htm&nav=/msj/1097/newnav.htm

I’m sorry the download is sparse with examples and information, but this is kind of new stuff for me also, and somebody urged me to upload what I had so far. When time permits, I’ll try to put in some more information.


>Hi
>
>I recently downloaded some code that ran VFP as a service. Once I downloaded the extra server tool everything appeared to work fine but unfortunately I wasn't much the wiser for my efforts (not unusual, I might add).
>
>Anyhow, what I was wondering was is it possible to create/remove a "service", start and stop it, etc using the api interface or other windows dlls. If so how???
>
>Also, I would like to understand a lot better how I go about programming a services so if some kind soul could point me in the right direction life would be just dandy.
>
>Regards
>Geoff Scott
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform