Subject | Re: [IBO] Start Interbase when my IBO App runs? |
---|---|
Author | Burak OZLER |
Post date | 2001-09-14T14:37Z |
I hope these help's
Burak ÖZLER
Burak ÖZLER
----- Original Message -----
From: "delphiman" <delphiman@...>
To: <IBObjects@yahoogroups.com>
Sent: Friday, September 14, 2001 1:42 AM
Subject: [IBO] Start Interbase when my IBO App runs?
> I didn't know this either!!
>
> For Heaven's sake - this is surely a pretty obvious requirement - so
let's have it!!
> I have in excess of 1200 users who will need it. (See other e-mail,)
>
> delphiman@...
> Mobile: (Australia) 0407-007-159
> Phone: ( Australia (02) 6041-1036)
> ICQ 63345769
>
>
> ----- Original Message -----
> From: Jason Wharton
> To: IBObjects@yahoogroups.com
> Sent: Friday, September 14, 2001 3:34 AM
> Subject: Re: [IBO] How can I automatically start Interbase when my IBO
App runs?
>
>
> > How can I get Interbase, if not already running, to start
automatically,
> > when my IBO application starts up.
> > (Currently using IBO 3.6)
>
> Not sure, I've never dealt with this issue.
>
> Jason Wharton
> CPS - Mesa AZ
> http://www.ibobjects.com
>
>
>
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
----------
From: Jeff Overcash (TeamB) <overcash@...>
Subject: Re: How to tell if InterBase is running? if not, how to start it?
Date: 17 Aralýk 2000 Pazar 05:29
function IsIBRunning(): boolean;
begin
if GetWindow(GetDesktopWindow,GW_HWNDNEXT)= FindWindow('IB_Server', 'InterBase
Server') then
result := false
else
result := true;
end;
function StartServer(): boolean;
var
lRegistry: TRegistry;
lStartUpInfo: STARTUPINFO;
lSecurityAttr: SECURITY_ATTRIBUTES;
lProcessInfo: PROCESS_INFORMATION;
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 system.')
else
lEXEName := Format('%s%s
-a',[lRegistry.ReadString('ServerDirectory'),'ibserver.exe']);
ZeroMemory(@lStartUpInfo, SizeOf(lStartUpInfo));
lStartUpInfo.cb := SizeOf(lStartUpInfo);
lSecurityAttr.nLength := SizeOf (lSecurityAttr);
lSecurityAttr.lpSecurityDescriptor := nil;
lSecurityAttr.bInheritHandle := TRUE;
if CreateProcess (nil,StrPCopy(lArray,lEXEName), @lSecurityAttr, nil, FALSE,
0, nil,
nil, lStartUpInfo, lProcessInfo) <> Null then
result := true
else
ShowMessage('The server could not be started.')
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
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 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
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;
Mike Low wrote:
>
> Hi,
> Is there a way to determine if a local Interbase server is running
> from one of the IBX components, and if not is there a way to start it?
> I noticed that IB Console asks you if you want to start IB Server if
> it's not already running. I would like to include that functionality
> into my program as well.
> Thanks,
> Mike
--
Jeff Overcash (TeamB) | Talk about failure
(Please do not email | To fall is not to fail
me directly unless | Failure isn't about falling down
asked. Thank You) | Failure is staying down (Marillion)
----------
From: Rita Lavoie <rita.lavoie@...>
To: <bibexpress@...>
Subject: Re: How to tell if InterBase is running? if not, how to start it?
Date: 17 Aralýk 2000 Pazar 16:12
Try this instead...
function TMainForm.StopServer: boolean;
var
lHWND: HWND;
lVersion: String;
lRegistry: TRegistry;
lEXEName: string;
lArray: array[0..255] of char;
begin
result := false;
lRegistry := TRegistry.Create;
try
Screen.Cursor := crHourglass;
lVersion := GetWindowsVersion;
if lVersion = 'NT' then
begin
lRegistry.RootKey := HKEY_LOCAL_MACHINE;
if not
lRegistry.OpenKey('Software\Borland\InterBase\CurrentVersion',False)
then
ShowMessage('Le Serveur Interbase n''est pas installé sur votre
système.')
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 = '95') or (lVersion = '98') 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 TMainForm.GetWindowsVersion: string;
const
sWindowsVersion = 'Windows %s %d.%.2d.%.3d %s';
var
Ver: TOsVersionInfo;
Platform: string[4];
begin
Ver.dwOSVersionInfoSize := SizeOf(Ver);
GetVersionEx(Ver);
with Ver do begin
case dwPlatformId of
VER_PLATFORM_WIN32s: Platform := '32s';
VER_PLATFORM_WIN32_WINDOWS:
begin
dwBuildNumber := dwBuildNumber and $0000FFFF;
if (dwMajorVersion > 4) or ((dwMajorVersion = 4) and
(dwMinorVersion >= 10)) then Platform := '98'
else Platform := '95';
end;
VER_PLATFORM_WIN32_NT: Platform := 'NT';
end;
Result := Platform;
end;
end;
----- Message d'origine -----
De : "Mike Low" <mike@...>
Groupes de discussion : borland.public.delphi.database.interbaseexpress
À : <bibexpress@...>
Envoyé : 17 déc. 2000 05:24
Objet : Re: How to tell if InterBase is running? if not, how to start it?
> Hi Jeff,
> Thanks for the wealth of information!!! IsIBRunning and StartGuardian
work
> perfectly. But I can't use StartServer or StopServer. StartServer did
nothing when
> it was called. This isn't a problem for me since my only concern is
starting IB if
> it isn't already running (which the first two functions). But I'm curious
as to the
> proper usage of StartServer and StopServer.
> Thanks again for the Code!!!!
> Mike Low
>
> I couldn't use StopServer for the following reason.
> I encountered the following error when trying to compile with StopServer:
> *** [Error] uIBstart.pas(117): Expression expected but ')' found
>
> > lVersion := OSVersionInfo();
>
> Any suggestions for OSVersionInfo?
>
> _______________________________________________
> Bibexpress mailing list
> Bibexpress@...
> http://mers.com/mailman/listinfo/bibexpress
[Non-text portions of this message have been removed]