[英]How to find if and where is installed firebird in delphi
Problem: I need to modify aliases.conf in firebird but.. as we know the user can install firebird anywhere he want. 问题:我需要在firebird中修改aliases.conf,但是..据我们所知,用户可以在他想要的任何位置安装firebird。 So I need to programmatically find out where the firebird was installed.
因此,我需要以编程方式找出firebird的安装位置。 I try to do that by registry but it's not good idea because withe almost every one new version of windows (2000, XP, VISTA, 7, 8 and 32 bit or 64 bit and may be 128 bit) the registry keys get change.
我尝试通过注册表来执行此操作,但这不是一个好主意,因为几乎每个新版本的Windows(2000,XP,VISTA,7、8和32位或64位,可能是128位)都会更改注册表项。 I try also find out procedure for searching registry like simple text file but no result.
我也尝试找出搜索注册表的过程,例如简单的文本文件,但没有结果。 I have try to find the "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\SharedDLLs\\aliases.conf" but it's not simple way.
我尝试找到“ HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Wow6432Node \\ Microsoft \\ Windows \\ CurrentVersion \\ SharedDLLs \\ aliases.conf”,但这不是简单的方法。 It's possible that the problem is not in registry function just in Lazarus but I do not know that.
问题可能不仅在拉撒路的注册表功能中存在,但我不知道。 So, may be some one has any idea how to check if and where is installed firebird.
因此,可能有人不知道如何检查以及在哪里安装了firebird。 Shortly say: I'm going to install my application with database file and have to have silently modify the aliases.conf.
简短地说:我将使用数据库文件安装我的应用程序,并且必须静默地修改aliases.conf。
You can find the installation location of Firebird by checking the registry key HKLM\\Software\\Firebird Project\\Firebird Server\\Instances
and reading the DefaultInstance
value. 通过检查注册表项
HKLM\\Software\\Firebird Project\\Firebird Server\\Instances
并读取DefaultInstance
值,可以找到Firebird的安装位置。
The following code should do the trick :- 下面的代码应该可以解决问题:-
var
lReg : TRegistry;
lStr : String;
begin
lReg := TRegistry.Create;
Try
lReg.RootKey := HKEY_LOCAL_MACHINE;
If lReg.OpenKey('Software\Firebird Project\Firebird Server\Instances', False) Then
lStr := lReg.ReadString('DefaultInstance');
lReg.CloseKey;
ShowMessage(lStr);
Finally
FreeAndNil(lReg);
End;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.