Programa tipo Servicio de Windows

Programa tipo Servicio de Windows

Postby cchg » Thu Nov 17, 2005 5:28 pm

Saludos.

Alguien sabe como hacer para que un prg funcione como un servicio de windows....?
cchg
 
Posts: 2
Joined: Thu Nov 17, 2005 5:26 pm

Postby Maurilio Viana » Wed Nov 23, 2005 12:18 pm

Intenta esto:

Code: Select all  Expand view
#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
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Postby Ugo » Sat Jan 14, 2006 3:16 pm

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
User avatar
Ugo
 
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 5 guests