procedure InitBde;
var
DataDirectory : string;
ARegistry : TRegistry;
begin
DataDirectory := ExtractFilePath( Application.ExeName );
DataDirectory := DataDirectory+'bde\';
ARegistry := TRegistry.Create;
with ARegistry do {创建一个TRegistry对象实例 }
begin
RootKey := HKEY_LOCAL_MACHINE;{指定根键为HKEY_LOCAL_MACHINE}
if not OpenKey( 'Software\Borland\BLW32', False ) then
begin
// showmessage('key 1'); {写入BDE语言驱动程序所在的目录,即当前程序目录 }
OpenKey( 'Software\Borland\BLW32', True ); //新建主键
WriteString( 'BLAPIPATH', DataDirectory );
end;
CloseKey; {关闭主键,同时将信息写入注册表}
RootKey := HKEY_LOCAL_MACHINE;
if not OpenKey('Software\Borland\Database Engine',False) then
begin
// showmessage('key 2');
OpenKey('Software\Borland\Database Engine',True); //新建主键
WriteString( 'DLLPATH', DataDirectory );
end;
CloseKey; {关闭主键,同时将信息写入注册表}
Destroy; {释放内存 }
end;
end;
var
DataDirectory : string;
ARegistry : TRegistry;
begin
DataDirectory := ExtractFilePath( Application.ExeName );
DataDirectory := DataDirectory+'bde\';
ARegistry := TRegistry.Create;
with ARegistry do {创建一个TRegistry对象实例 }
begin
RootKey := HKEY_LOCAL_MACHINE;{指定根键为HKEY_LOCAL_MACHINE}
if not OpenKey( 'Software\Borland\BLW32', False ) then
begin
// showmessage('key 1'); {写入BDE语言驱动程序所在的目录,即当前程序目录 }
OpenKey( 'Software\Borland\BLW32', True ); //新建主键
WriteString( 'BLAPIPATH', DataDirectory );
end;
CloseKey; {关闭主键,同时将信息写入注册表}
RootKey := HKEY_LOCAL_MACHINE;
if not OpenKey('Software\Borland\Database Engine',False) then
begin
// showmessage('key 2');
OpenKey('Software\Borland\Database Engine',True); //新建主键
WriteString( 'DLLPATH', DataDirectory );
end;
CloseKey; {关闭主键,同时将信息写入注册表}
Destroy; {释放内存 }
end;
end;
解决方案 »
- 用adoquery查询表的分组,然后分别打印每组数据,fastreport 如何实现?抱歉只有20分
- 急求!!!用TQuery查询SQL Server2000数据库时的问题!——delphi菜鸟级问题
- 求助,菜鸟问题散分啦
- 用Delphi怎么实现数据库的分页呀?
- 如何制作输入法的安装程序?
- 1stclass3000的怪问题,(DFW上解决不了)请教哥哥姐姐们
- SQL高手请进!
- 计论一下政府采购案对程序员的影响?
- 请问在delphi中如何编写自己的模块文件,怎么样输写格式,如何在程序中调用??
- 综合问题,高手快来
- 菜尿请教:如何给GroupBox加上滚动条?
- 请问怎样从Graphic字段中读出一个图像到Image组件?向各位老兄请教,谢谢!
你必须在窗体中放一个TMemo控件,以打开文本文件.
uses Registry;
procedure TForm1.RegistryFile;
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
Reg.RootKey := HKEY_CLASSES_ROOT;
Reg.OpenKey('txtfile\shell\open with my program\command', true);
Reg.WriteString('', Application.ExeExeName + ' %1';
Reg.CloseKey;
Reg.Free;
end;procedure TForm1.Create(Sender: TObject);
begin
RegistryFile;
if FileExists(ParamStr(1)) then
Memo1.Liens.LoadFromFile(ParamStr(1));
end;
//程序先运行一次,然后在资源管理器中右击试试吧。