Subject | Re: [firebird-support] How to test if Firebird allready installed? |
---|---|
Author | emel.hu |
Post date | 2004-10-23T08:12:48Z |
> The Firebird1.5.1 Win32.exe install program tests to see if Firebird isFirst I check: is it DLL installed?
> running or not.
If not installed I ask from user (inside TfrmIBInstal) what do want
install client or server.
eMeL
Example code:
//-----------------------------------------------------------------------------
bool __fastcall CheckIBFBLibrary(void)
{
if (IBFB_DLL == NULL)
{
unsigned int semOLD = SetErrorMode(SEM_NOOPENFILEERRORBOX);
IBFB_DLL = LoadLibrary(IBFB_DLL_Name);
SetErrorMode(semOLD);
}
return IBFB_DLL;
}
//-----------------------------------------------------------------------------
bool __fastcall CheckIBInstalled(bool bException, bool bSilent)
{
bool bRet;
do
{
bRet = CheckIBFBLibrary();
if (! bRet)
{
char * sMsg = "This program need Firebird database.\n\n"
"Do you want install it now ?";
if (! bSilent && MessageDlg(sMsg, mtConfirmation,
TMsgDlgButtons() << mbYes << mbNo, 0) == mrYes)
{
TfrmIBInstal * frmIBInstal = NULL;
try
{
frmIBInstal = new TfrmIBInstal(NULL);
frmIBInstal->ShowModal();
delete frmIBInstal;
}
catch (Exception &E)
{
delete frmIBInstal;
if (bException)
{
throw;
}
else
{
ShowMessage(E.Message);
}
}
}
else
{
bRet = false;
char * sErr = "This program need Firebird database.....\n\n"
".......";
if (bException)
{
throw Exception(sErr);
}
else
{
ShowMessage(sErr);
break;
}
}
}
} while (! bRet);
return bRet;
}
//---------------------------------------------------------------------------