Page 1 of 1

Programa tipo Servicio de Windows

Posted: Thu Nov 17, 2005 5:28 pm
by cchg
Saludos.

Alguien sabe como hacer para que un prg funcione como un servicio de windows....?

Posted: Wed Nov 23, 2005 12:18 pm
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

Posted: Sat Jan 14, 2006 3:16 pm
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,