Subject | Re: [ib-support] Stop / Start IB server from the command line under Win988/Me |
---|---|
Author | Andreas Pohl |
Post date | 2001-10-19T07:24:37Z |
I've got this Delphi code from somebody. Maybe you can adapt this.
Mit freundlichem Gruss & Best Regards
Andreas Pohl
apohl@...
www.ibp-consult.com
function IsIBRunning(): boolean;
begin
if GetWindow(GetDesktopWindow,GW_HWNDNEXT)= FindWindow('IB_Server',
'InterBase Server') then
result := false
else
result := true;
end;
function StopServer(): boolean;
var
lHWND: HWND;
lVersion: DWORD;
lRegistry: TRegistry;
lEXEName: string;
lArray: array[0..255] of char;
begin
result := false;
lRegistry := TRegistry.Create;
try
Screen.Cursor := crHourglass;
lVersion := OSVersionInfo();
if lVersion = VER_PLATFORM_WIN32_NT then
begin
lRegistry.RootKey := HKEY_LOCAL_MACHINE;
// if not lRegistry.OpenKey('Software\Borland\InterBase\CurrentVersion',False) then
if not lRegistry.OpenKey('Software\InterBase Corp\InterBase\CurrentVersion',False) then
ShowMessage('InterBase server is not installed on your system.')
else
lEXEName :=Format('%s\%s',[lRegistry.ReadString('ServerDirectory'),'instsvc.exe stop']);
if WinExec(StrPCopy(lArray,lEXEName), 2) > 31 then
result := true;
end
else if lVersion = VER_PLATFORM_WIN32_WINDOWS then
begin
lHWND:= FindWindow('IB_Server', 'InterBase Server');
if PostMessage(lHWND, WM_CLOSE, 0, 0)<> Null then
result := true;
Application.ProcessMessages;
end;
finally
lRegistry.Free;
Screen.Cursor := crDefault;
end;
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
if not lRegistry.OpenKey('Software\InterBase Corp\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;
function OSVersionInfo():Integer;
var os:TOSVERSIONINFO;
begin
os.dwOSVersionInfoSize:=sizeof(os);
GetVersionEx(os);
result:=os.dwPlatformId;
end;
Mit freundlichem Gruss & Best Regards
Andreas Pohl
apohl@...
www.ibp-consult.com
function IsIBRunning(): boolean;
begin
if GetWindow(GetDesktopWindow,GW_HWNDNEXT)= FindWindow('IB_Server',
'InterBase Server') then
result := false
else
result := true;
end;
function StopServer(): boolean;
var
lHWND: HWND;
lVersion: DWORD;
lRegistry: TRegistry;
lEXEName: string;
lArray: array[0..255] of char;
begin
result := false;
lRegistry := TRegistry.Create;
try
Screen.Cursor := crHourglass;
lVersion := OSVersionInfo();
if lVersion = VER_PLATFORM_WIN32_NT then
begin
lRegistry.RootKey := HKEY_LOCAL_MACHINE;
// if not lRegistry.OpenKey('Software\Borland\InterBase\CurrentVersion',False) then
if not lRegistry.OpenKey('Software\InterBase Corp\InterBase\CurrentVersion',False) then
ShowMessage('InterBase server is not installed on your system.')
else
lEXEName :=Format('%s\%s',[lRegistry.ReadString('ServerDirectory'),'instsvc.exe stop']);
if WinExec(StrPCopy(lArray,lEXEName), 2) > 31 then
result := true;
end
else if lVersion = VER_PLATFORM_WIN32_WINDOWS then
begin
lHWND:= FindWindow('IB_Server', 'InterBase Server');
if PostMessage(lHWND, WM_CLOSE, 0, 0)<> Null then
result := true;
Application.ProcessMessages;
end;
finally
lRegistry.Free;
Screen.Cursor := crDefault;
end;
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
if not lRegistry.OpenKey('Software\InterBase Corp\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;
function OSVersionInfo():Integer;
var os:TOSVERSIONINFO;
begin
os.dwOSVersionInfoSize:=sizeof(os);
GetVersionEx(os);
result:=os.dwPlatformId;
end;
----- Original Message -----
From: "Fabrice Aeschbacher" <fabrice.aeschbacher@...>
To: <ib-support@yahoogroups.com>
Sent: Friday, October 19, 2001 8:32 AM
Subject: [ib-support] Stop / Start IB server from the command line under Win988/Me
> Hi,
>
> To stop / start IB server from the command line under NT4 / 2000, the
> following works:
>
> NET STOP INTERBASESERVER
> NET START INTERBASESERVER
>
> How is it possible to do this under Win98 / Me?
>
> Regards,
>
> Fabrice
> mailto:fabrice.aeschbacher@...
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>