Ver Mensaje Individual
  #4  
Antiguo 15-11-2016
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola.

Fijate si te sirve esta opción,

checkFirebird.h:
Código PHP:
#ifndef checkFirebirdH
#define checkFirebirdH

bool isFirebirdRunningvoid );

#endif 
checkFirebird.cpp:
Código PHP:
#pragma hdrstop

#include "checkFirebird.h"
#include "WinSvc.hpp"

#pragma package( smart_init )

DWORD ServiceStatus( const char* &sMachine, const char* &sService )
{
  
SC_HANDLE schmschs;
  
TServiceStatus ss;
  
DWORD dwStat 0;

  
schm OpenSCManagersMachineNULLSC_MANAGER_CONNECT );

  if ( 
schm ) {
    
schs OpenServiceschmsServiceSERVICE_QUERY_STATUS );

    if ( 
schs ) {
      if ( 
QueryServiceStatus schs, &ss ) )
        
dwStat ss.dwCurrentState;
      
CloseServiceHandleschs );
    }

    
CloseServiceHandle schm );
  }
  return 
dwStat;
}

bool isFirebirdRunningvoid )
{
  return 
ServiceStatus"""FirebirdServerDefaultInstance" ) == SERVICE_RUNNING;

Ejemplos de uso:
Código PHP:
...

#include "checkFirebird.h"

...

void __fastcall TForm1::ButtonCheckClickTObject *Sender )
{
  
ShowMessage( (isFirebirdRunning() ? "Servicio de Firebird activo" "Servicio de Firebird inactivo") );
  ...
  if ( 
isFirebirdRunning() )
  ... 
Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita