Melhor, me lembrei que já tinha feito isso. function ServiceStart(ServiceName: string) : boolean; var schm, schs : SC_Handle; ss : TServiceStatus; psTemp : PChar; dwChkP : DWord; // check point begin ss.dwCurrentState := DWORD(-1); // connect to the service control manager schm := OpenSCManager(nil, nil, SC_MANAGER_CONNECT); if(schm = 0)then RaiseLastOSError;
// if successful... try // open a handle to the specified service // we want to start the service and query service // status schs := OpenService(schm, PChar(ServiceName), SERVICE_START or SERVICE_QUERY_STATUS); if(schs = 0)then RaiseLastOSError; // if successful... try psTemp := Nil; if not (StartService( schs, 0,psTemp))then RaiseLastOSError else begin // check status if not (QueryServiceStatus(schs, ss))then RaiseLastOSError else begin while(SERVICE_RUNNING <> ss.dwCurrentState)do begin // dwCheckPoint contains a value that the // service increments periodically to // report its progress during a // lengthy operation. Save current value dwChkP := ss.dwCheckPoint; // wait a bit before checking status again // dwWaitHint is the estimated amount of // time the calling program should wait // before calling QueryServiceStatus() // again. Idle events should be // handled here... Sleep(ss.dwWaitHint); if not QueryServiceStatus(schs, ss) then begin // couldn't check status break from the // loop RaiseLastOSError end; if ss.dwCheckPoint < dwChkP then begin // QueryServiceStatus didn't increment // dwCheckPoint as it should have. // Avoid an infinite loop by breaking break; end; end; end; end; finally // close service handle CloseServiceHandle(schs); end; finally // close service control manager handle CloseServiceHandle(schm); end; // Return TRUE if the service status is running Result := SERVICE_RUNNING = ss.dwCurrentState; end; Bollasette escreveu: > > > A/C Alexandre Rodrigues, > > Em Ferramentas Administrativas tem opções de inicialização do MYSQL > Automático, manual e desativar. > > Como fazer isso pelo D7 ? > > ABçs, Henrique > > ----- Original Message ----- > From: Alexandre Rodrigues > To: delphi-br@yahoogrupos.com.br <mailto:delphi-br%40yahoogrupos.com.br> > Sent: Tuesday, July 01, 2008 12:57 PM > Subject: Re: [delphi-br] Colocar o MySqL em serviço > > Como assim colocar ele a rodar como serviço? Isso tu define na > instalação do MySQL. > > Bollasette escreveu: > > > > > > Olá,,, B.dia a todos,,, > > > > Meus amigos, gostaria d saber se há como colocar o MySQL > > em serviço de dentro do D7 ? > > > > Uma função, uma procedure ? > > > > Chequei esta propriedade //ServiceStartName > > mas é da CLasse (TService). > > > > Obrigados a todos, > > > > Henrique > > WebSistemas > > S.Paulo,SP > > > > > > _______________________________________________________ > Yahoo! Mail - Sempre a melhor opção para você! > Experimente já e veja as novidades. > http://br.yahoo.com/mailbeta/tudonovo/ > <http://br.yahoo.com/mailbeta/tudonovo/> > > ---------------------------------------------------------- > > No virus found in this incoming message. > Checked by AVG. > Version: 8.0.101 / Virus Database: 270.4.3/1528 - Release Date: > 01-07-2008 07:26 > > [As partes desta mensagem que não continham texto foram removidas] > > __________________________________________________ Faça ligações para outros computadores com o novo Yahoo! Messenger http://br.beta.messenger.yahoo.com/