Subject Re: Check if IB server is running
Author gerbreown@mindspring.com
Luiz,

I added your code below to my applicaiton and it works like a charm!!!
I had to make one small addition: in the Format statement I had to add
a '\' in front of the "ibguard.exe". That might be because I was
messing with my registery and might have deleted the trailing '\' in
there.

I added the following line to the first object that is created: "if
not IsIBRunning then StartGuardian;" and it starts the server. I
plan to create a variable and set it to T/F depending on the results
of IsIBRunning. If the variable is F when the application ends then I
want to shut down the server again so it is only running while my
application is running unless it was running before my application
started. Do you have any code to shut the server down???

Thanks,

Gerald S. Brown

--- In IBObjects@egroups.com, "Luiz Alves" <cprmlao@i...> wrote:
> You could try what ib_console does:
>
> Here is :
>
> function IsIBRunning(): boolean;
> begin
> if GetWindow(GetDesktopWindow,GW_HWNDNEXT)=
FindWindow('IB_Server',
> 'InterBase Server') then
> result := false
> else
> result := true;
> end;
>
>
> function StartGuardian(): boolean;
> var
> lRegistry: TRegistry;
> lEXEName: string;
> lArray: array[0..255] of char;
> begin
> result := false;
> lRegistry := TRegistry.Create;
> try
> Screen.Cursor := crHourglass;
> lRegistry.RootKey := HKEY_LOCAL_MACHINE;
> if not
> lRegistry.OpenKey('Software\Borland\InterBase\CurrentVersion',False)
then
> ShowMessage('InterBase server is not installed on your
computer.')
> else
> lEXEName := Format('%s%s
> ',[lRegistry.ReadString('ServerDirectory'),'ibguard.exe']);
> finally
> if WinExec(StrPCopy(lArray,lEXEName),1) > 31 then
> result := true;
> lRegistry.Free;
> Screen.Cursor := crDefault;
> end;
> end;
>
> Luiz.
> ----- Original Message -----
> From: <gerbreown@m...>
> To: <IBObjects@egroups.com>
> Sent: Monday, November 27, 2000 5:57 PM
> Subject: [IBO] Check if IB server is running
>
>
> > Jason,
> >
> > Is there an IBO component that I can use from within my Delphi
> > application to see if the local IB server is currently running?
If it
> > is not running then I want to start it before my application tries
to
> > access any databases. I then want shut it down, if I started it,
just
> > before my applicition quits. If it was running when my
application
> > started then I would leave it run at appliction quit time.
> >
> > Thanks,
> >
> > Gerald S. Brown
> >
> >
> >
> >
> >