Interbase - start e shutdown

Top  Previous  Next

// Shut down no IB -- not tested

 

 

function ShutDownInterbase : boolean;

var IBSRVHandle,IBGARHandle : THandle;

begin

if IsNT then begin

  result := ServiceStop('','InterBaseGuardian');

end else begin

  IBGARHandle := FindWindow('IB_Guard','InterBase Guardian');

  if IBGARHandle > 0 then begin

   PostMessage(IBGARHandle,31,0,0);

   PostMessage(IBGARHandle,16,0,0);

  end;

  IBSRVHandle := FindWindow('IB_Server','InterBase Server');

  if IBSRVHandle > 0 then begin

   PostMessage(IBSRVHandle,31,0,0);

   PostMessage(IBSRVHandle,16,0,0);

  end;

  result := InterbaseRunning;

end;

end;

---------------------

 

 

 Inicia o IB

 

 

function StartInterbase : boolean;

var Filename : string;

    StartupInfo: TStartupInfo;

    ProcessInformation: TProcessInformation;

begin

filename := GetInterbaseGuardianFile;

if FileExists(Filename) then begin

  if IsNT then begin

   result := ServiceStart('','InterBaseGuardian');

  end else begin

   Fillchar(StartupInfo,Sizeof(TStartupInfo),0);

   StartupInfo.cb := sizeof(StartupInfo);

   StartupInfo.lpReserved := nil;

   StartupInfo.lpTitle:= nil;

   StartupInfo.lpDesktop := nil;

   StartupInfo.dwFlags := STARTF_USESHOWWINDOW;

   StartupInfo.wShowWindow := SW_SHOWNA;

   StartupInfo.cbReserved2 := 0;

   StartupInfo.lpReserved2 := nil;

   result :=

CreateProcess(nil,PChar(filename),nil,nil,False,NORMAL_PRIORITY_CLASS,

    nil,PChar(ExtractFilePath(filename)),StartupInfo,ProcessInformation);

  end;

end else result := false;

end;