Programa tipo Servicio de Windows

Post Reply
cchg
Posts: 2
Joined: Thu Nov 17, 2005 5:26 pm

Programa tipo Servicio de Windows

Post by cchg »

Saludos.

Alguien sabe como hacer para que un prg funcione como un servicio de windows....?
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Post by Maurilio Viana »

Intenta esto:

Code: Select all

#include "FiveWin.ch"
//-------------------------
Function Main()
//-------------------------

ServiceProcess(1)

---- Tu codigo aqui 


Return NIL


//------------------------------
Function ServiceProcess( mode )
//------------------------------
Local nProcessId := 0

Default mode := 0

nProcessId := GCP( )

If Abs( nProcessId ) > 0
    RSProcess( nProcessId, mode )

Endif

RETURN

//----------------------------------------------------
DLL32 FUNCTION RSProcess(npID  AS LONG ,;
                         nMode AS LONG ) AS LONG ;
      FROM "RegisterServiceProcess" LIB "kernel32.DLL"
//----------------------------------------------------

//----------------------------------------------------
DLL32 FUNCTION GCP() AS LONG;
      FROM "GetCurrentProcessId" LIB "kernel32.dll"
//----------------------------------------------------
Pienso que tal vez no funcione con FW/Clipper, solamente con FW/[x]Harbour...

Saludos
Maurilio
User avatar
Ugo
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Post by Ugo »

Maurilio Viana wrote:Intenta esto:

Pienso que tal vez no funcione con FW/Clipper, solamente con FW/[x]Harbour...
Hi Maurilio,
I have 2 question:

1) is possible to run and stop the service with the normal windows interface?

2) also an MT program (only console) is possible transform into a service?

Thank you,
Ciao, best regards,
Ugo
Post Reply