关于读注册表及写注册表问题?各位富翁请进!(50分)

  • 主题发起人 主题发起人 lijing88688
  • 开始时间 开始时间
L

lijing88688

Unregistered / Unconfirmed
GUEST, unregistred user!
我想在注册表中用READBINARYDATA读取二进制数据,然后将其中的一部分改动再写回注册表,
不知如何操作,请各位富翁赐教!
 
添加Registry到uses中
var
Reg: Tregistry;
buf: Integer;
begin
Reg:=Tregistry.Create;
try
Reg.Rootkey:= HKEY_CURRENT_USER;
if Reg.OpenKey('/Software/Microsoft/Windows/CurrentVersion/Policies/Explorer', False)
then
begin
buf := 1;
if NOT Reg.ValueExists('NoRun') then
Reg.WriteBinaryData('NoRun',buf,4);
…… …… ……
end;
finally
Reg.CloseKey;//将更改内容写入注册表并关闭
Reg.Free;//释放对象
end;
end;
 
能不能再列出一些更详细的用法,我现在很想学!
 
提供参考
在Delphi3.0 及 以 上 版 本 中, 提 供 了 一 个 构 件TRegistry。 在 程 序 中 可 以 利 用 它 来 实 现 对WIN95/98/NT 注 册 表 的 操 作, 可 以 很 方 便 地 在 注 册 表 中 增 加、 修 改 和 删 除 键 值。 这 样 可 以 在 程 序 中 完 成 一 些 特 殊 的 功 能。

---- TRegistry 常 用 的 属 性 和 方 法 有( 具 体 作 用 和 用 法 请 参 考Delphi 帮 助):

RootKey、CreateKey、OpenKey、
CloseKey、DeleteKey、ReadXXXX、WriteXXXX
(XXXX表示数据类型如String、Integer等)
---- 我 们 用 到 的 属 性 和 方 法 有:

RootKey:注册表的根键名( 如HKEY_LOCAL_MACHINE等)
OpenKey( KeyName:string; CanCreate:boolean ):
---- 使 当 前 键 为KeyName,CanCreate 表 示 当 指 定 的 键 不 存 在 时 是 否 创 建,True 表 示 创 建

SetKey( KeyName,KeyValue : string ):
使键KeyName的值为KeyValue
---- 应 用 之 一: 让 自 己 的 程 序 随WIN95/98/NT 的 启 动 而 运 行

---- 当 然, 你 可 以 在 " 启 动 " 程 序 组 中 加 入 程 序 的 快 捷 方 式, 但 这 样 做 好 象 不 大 明 智, 因 为 大 多 数 程 序 在 安 装 时 不 会 这 样 做, 而 是 在 通 过 在 注 册 表 增 加 键 值, 让WIN95/98/NT 在 启 动 时 运 行 自 己 的 程 序。 如 果 打 开 注 册 表, 找 到HKEY_LOCAL_MACHINE /Software /Microsoft /Windows /CurrentVersion /Run, 就 会 发 现 这 个 秘 密 了, 原 来 许 多 自 动 运 行 的 程 序 都 在 这 里。 你 也 可 以 在 这 里 增 加 一 个 键, 让 你 的 程 序 也 随 着 WIN95/98/NT 的 启 动 而 自 己 运 行, 成 为WINDOWS 下 的TSR 程 序。 实 现 方 法 如 下:

---- 首 先, 在Uses 中 加 上Registry 单 元

---- 然 后, 写 下 面 代 码。

{将程序strExeFileName置为自动启动 }
function StartUpMyProgram
( strPrompt,strExeFileName : string ) : boolean;
var
registerTemp : TRegistry;
begin
registerTemp := TRegistry.Create;
//建立一个Registry实例
with registerTemp do
begin
RootKey:=HKEY_LOCAL_MACHINE;
//设置根键值为HKEY_LOCAL_MACHINE
//找到Software/Microsoft/Windows/CurrentVersion/Run
if OpenKey('Software/Microsoft/Windows
/CurrentVersion/Run',True) then
//写入自己程序的快捷方式信息
begin
WriteString( strPrompt, strExeFileName );
result := true;
end
else result := false;
//善后处理
CloseKey;
Free;
end;
end;

{调用StartUpMyProgram,
使Delphi随WINDOWS启动而自动运行 }
procedure TForm1.Button1Click(Sender: TObject);
begin
memo1.lines.add('开始');
if StartUpMyProgram('delphi','C:/Program
Files/borland/delphi3/bin/delphi32.exe') then
memo1.lines.add('成功')
else
memo1.lines.add('失败')
end;
---- 应 用 之 二: 实 现 文 件 关 联

---- 当MS WORD 安 装 在 你 的 系 统 中 时, 它 会 把.DOC 文 件 与 自 己 关 联, 当 你 双 击 一 个DOC 文 件, 就 会 启 动MS WORD, 打 开 你 指 定 的DOC 文 件。 你 也 可 以 把 一 个 文 件 类 型 与 一 个 程 序 关 联 起 来, 其 秘 密 还 是 在 注 册 表 中。 如 果 打 开 注 册 表, 找 到HKEY_CLASSES_ROOT, 就 会 发 现 这 里 已 经 有 很 多 文 件 类 型。

---- 你 也 可 以 在 这 里 增 加 一 个 键, 建 立 自 己 的 文 件 关 联。

---- 建 立 文 件 关 联, 一 般 应 有 两 个 步 骤:

---- ( 1) 根 据 文 件 类 型 的 扩 展 名, 指 定 对 应 的 键 名( 如doc 文 件 对 应 的 键 为doc_auto_file)

---- 该 键 及 其 子 键 的 值, 将 定 义 该 类 型 的 文 件 的 类 型 说 明 和 操 作( 如 打 开、 编 辑) 说 明

---- ( 2) 在 指 定 的 键 名 下, 建 立 子 键, 指 明 文 件 类 型 说 明 和 操 作 对 应 的 程 序 信 息

---- 例 如, 我 们 可 以 为.DBF 文 件 建 立 文 件 关 联, 其 文 件 类 型 说 明 为 "xBase 数 据 表 ", 使 其 打 开(Open) 文 件 的 操 作 对 应 程 序C:/Program Files/Borland/DBD/DBD32.EXE。 首 先, 应 在 注 册 表 的 根 键HKEY_CLASSES_ROOT 下 建 立 一 个 键, 键 名 为.DBF, 默 认 值 为DBF_Auto_File, 表 示DBF 类 型 文 件 的 关 联 操 作 信 息 记 录 在 键HKEY_CLASSES_ROOT/DBF_Auto_File 下; 然 后, 建 立 键HKEY_CLASSES_ROOT/DBF_Auto_File, 并 设 其 默 认 值 为 "xBase 数 据 表 ", 表 示 文 件 类 型 说 明; 再 建 立 键 HKEY_CLASSES_ROOT/DBF_Auto_File/Shell/open/command, 设 置 其 默 认 值 为 C:/Program Files/Borland/DBD/DBD32.EXE  %1( 其 中 "%1 " 为 命 令 行 参 数), 表 示 打 开 操 作 对 应 的 程 序 信 息。


---- 具 体 实 现 如 下: 同 样, 在Uses 中 加 上Registry 单 元,   然 后, 写 下 面 代 码。

{将文件类型strFileExtension与程序
strExeFileName相关联,strDiscription为文件类型说明 }
function AssignToProgram(strFileExtension,
strDiscription,strExeFileName : string ) : boolean;
var
registerTemp : TRegistry;
begin
registerTemp := TRegistry.Create;
//建立一个Registry实例
with registerTemp do
begin
RootKey:=HKEY_CLASSES_ROOT;
//设置根键值为HKEY_CLASSES_ROOT

//根据文件类型的扩展名,创建或打开对应的键名
.FileExt,如DBF对应'.DBF'
if OpenKey( '.' + strFileExtension, true ) then
begin
result := false;
exit;
end;
//设置键.FileExt默认值为FileExt_Auto_File,
如'.DBF'对应'DBF_Auto_File'
WriteString('',strFileExtension + '_Auto_File');
CloseKey;

//写入自己程序的信息
//根据文件类型的扩展名,创建或打开对应的键名
FileExt_Auto_File
//'.DBF'对应'DBF_Auto_File'
if OpenKey(strFileExtension + '_Auto_File', true ) then
begin
result := false;
exit;
end;
//设置默认值文件类型说明,如DBF可对应'xBase数据表'
WriteString('',strDiscription);
CloseKey;

//创建或打开键名FileExt_Auto_File
/Shell/open/command,该键为表示操作为'打开'
//'.DBF'对应'DBF_Auto_File/shell/open/command'
if OpenKey(strFileExtension + '_Auto_File
/shell/open/command', true ) then
begin
result := false;
exit;
end;
//设置该键的默认值为打开操作对应的程序信息
//如DBF可对应'C:/Program Files/Borland/DBD/DBD32.EXE'
WriteString('',strExeFileName + ' %1');
CloseKey;

Free;
end;
end;

{调用AssignToProgram,使DBF文件与DBD32.EXE关联 }
procedure TForm1.Button3Click(Sender: TObject);
begin
memo1.lines.add('开始');
if AssignToProgram('DBF','xBase数据表'
,'C:/Program Files/borland/dbd/dbd32.exe') then
memo1.lines.add('成功')
else
memo1.lines.add('失败')
end;
---- 应 用 之 三: 检 测Win95/98/NT 系 统 中 是 否 安 装 了Borland Database Engine

---- 当 你 的 应 用 程 序 是 一 个 基 于BDE 的 数 据 库 应 用 程 序 时, 如 果 运 行 在 一 个 没 有 安 装BDE 的Win95/98/NT 中, 会 出 现 让 用 户 迷 惑 不 解 的 错 误。 你 可 能 需 要 在 程 序 正 常 运 行 之 前, 检 查 系 统 中 是 否 安 装 了BDE。 由 于 BDE 安 装 后 会 在 注 册 表 进 行 注 册, 你 可 以 通 过 查 询 注 册 表 来 确 定 系 统 中 是 否 安 装 了BDE, 然 后 决 定 下 一 步 采 取 什 么 行 动。BDE 在 注 册 表 中 的 位 置 为:HKEY_LOCAL_MACHINE/Software/Borland/Database Engine, 该 键 存 在 说 明BDE 已 经 安 装。

---- 具 体 的 例 子 如 下。

---- 同 样, 在Uses 中 加 上Registry 单 元

---- 然 后, 写 下 面 代 码。

{检测系统中是否安装了BDE }
function IsBDEInstalled : boolean;
var
registerTemp : TRegistry;
begin
registerTemp := TRegistry.Create;
//建立一个Registry实例
with registerTemp do
begin
RootKey:=HKEY_LOCAL_MACHINE;
//设置根键值为HKEY_LOCAL_MACHINE
//查询Software/Borland/Database Engine
result := OpenKey('Software/Borland
/Database Engine',false);

//善后处理
CloseKey;
Free;
end;
end;

{调用IsBDEInstalled,检测系统中是否安装了BDE }
procedure TForm1.Button4Click(Sender: TObject);
begin
memo1.lines.add('开始');
if IsBDEInstalled then
memo1.lines.add('已安装了BDE')
else
memo1.lines.add('未安装BDE')
end;
---- 应 用 之 四: 在 桌 面 建 立 程 序 的 快 捷 方 式

---- 当 你 的WIN95/98/NT 桌 面 上 整 齐 地 排 列 着 各 种 程 序 的 快 捷 方 式 时, 也 许 你 会 体 会 到 快 捷 方 式 的 方 便。 你 也 可 将 自 己 设 计 的 程 序 的 快 捷 方 式 放 在 别 人 的 桌 面 上。

---- 桌 面 上 的 一 个 快 捷 方 式, 对 应Windows 目 录 下Destop 子 目 录 中 的 一 个ShellLink 文 件(.LNK), 你 只 要 在 这 个 目 录 下 增 加 一 个.LNK 文 件 就 可 以 了。

---- 我 们 的 任 务, 主 要 是 利 用TRegistry 从 注 册 表 中 获 取Desktop 的 实 际 路 径, 默 认 为Windows 目 录 下 的Desktop 子 目 录, 如C:/PWIN98/Desktop。 在 注 册 表 中Desktop 的 实 际 路 径 对 应 的 键 为HKEY_CURRENT_USER /Software /MicroSoft /Windows /CurrentVersion /Explorer /Shell Folders /Desktop。

---- 同 样, 在Uses 中 加 上Registry 单 元

---- 然 后, 写 下 面 代 码。

{为程序strExeFileName在桌面建立快捷方式,
运行参数为strParameters }
function CreateShortcutOnDesktop
( strExeFileName, strParameters : string ) : boolean;
var
registerTemp : TRegistry;
strDesktopDirectory : widestring;
shelllinkTemp : IShellLink;
persistfileTemp : IPersistFile;
begin
registerTemp := TRegistry.Create;
//建立一个Registry实例
with registerTemp do
begin
RootKey:=HKEY_CURRENT_USER;
//设置根键值为HKEY_CURRENT_USER
//找到Software/MicroSoft/Windows/
CurrentVersion/Explorer/Shell Folders
if not OpenKey('Software/MicroSoft/Windows/
CurrentVersion/Explorer/Shell Folders',True) then
//写入自己程序的信息
begin
result := false;
exit;
end;
//读取项目Desktop的值,即Desktop的实际路径
strDesktopDirectory := ReadString('Desktop');

//善后处理
CloseKey;
Free;
end;

//设置快捷方式的参数
shelllinkTemp := IShellLink( CreateComObject(CLSID_ShellLink));
with shelllinkTemp do
begin
SetPath( PChar( strExeFileName ) );
//设置程序文件全名
SetArguments( PChar( strParameters) );
//设置程序的命令行参数
//设置程序的工作目录
SetWorkingDirectory( Pchar
( ExtractFilePath( strExeFileName ) ) );
end;

//构造快捷方式的文件名(.LNK)
strDesktopDirectory := strDesktopDirectory + '/' +
ExtractFileName( strExeFileName );
strDesktopDirectory := copy( strDesktopDirectory,
1, length( strDesktopDirectory ) -
length( ExtractFileExt( strExeFileName ) ) )
+ '.LNK';
//保存快捷方式的文件
persistfileTemp := shelllinkTemp as IPersistFile;
if S_OK = persistfileTemp.Save( PWChar
( strDesktopDirectory ) , false ) then
result := true //保存成功,返回True
else result := false;
end;

{调用CreateShortcutOnDesktop,为Delphi在桌面上建立快捷方式 }
procedure TForm1.Button2Click(Sender: TObject);
begin
memo1.lines.add('开始');
if CreateShortcutOnDesktop('C:/Program
Files/borland/delphi3/bin/delphi32.exe','%1') then
memo1.lines.add('成功')
else
memo1.lines.add('失败')
end;
---- 上 面 几 个 应 用 只 是TRegistry 一 些 简 单 的 应 用, 有 了 这 些 知 识, 你 就 可 以 根 据 自 己 的 需 要 来 定 制 和 改 善Winodws 系 统 了。

---- 以 上 程 序 在PWin98+Delphi3.0 下 调 试 和 通 过。

 
(Text version)

Delphi and the Registry

by Christian Feichtner

Contents:

0. DISCLAIMER:
1. What is the registry?
2. What does the registry look like?
3. How to read and write data to the registry
3.1 RegCreateKey()
3.2 RegOpenKey()
3.3 RegSetValue()
3.4 RegQueryValue()
3.5 RegDeleteKey()
3.6 RegEnumKey()
4. An Example
5. Win95 features
6. REGDLL.DLL

The source code corresponding to this article is available for download as
registry.zip.



0. DISCLAIMER:

This article reflects my personal experiences with the registry and Delphi.
I had no 'real' documentation on this, except what shipped with Delphi. I
will not take any responsibility that occurs from the usage of the
procedures described in this article. The same applies to the usage of the
accompanying REGDLL.DLL and its interface. USE AT YOUR OWN RISK.

Suggestions and Comments are welcome. Please send them to:
Christian.Feichtner@jk.uni-linz.ac.at.

This article describes how to use the registry-database as an 'INI file'.
Especially with the advent of Windows 95 every 'good' windows application
should use the registry database to store its information.

Note that the described API routines are from the 16bit API. They work well
with the registry of Windows 95, but are not capable of using the special
new features of Windows 95.



1. What is the registry?

The registry is a heirarchical database, which is used to store information
for the whole system. OLE-apps made frequent use of the registry in Win31.
In Windows 95 the registry has grown to more than that. It not only stores
system information but has become a total replacement for the old-style INI
files. The INI files are only supported to maintain compatibility for 'old'
16bit Apps.



2. What does the registry look like?

As mentioned above, the registry is a heirarchical database. It is
organized as a tree. The most interesting key (and the only one accessable
from Delphi with the 16bit version) is the HKEY_CLASSES_ROOT.

This key can be used to store application settings. (Thus, I think there is
another key for Windows 95 apps. Since Delphi can only access this key, you
can use it until Delphi-32 becomes avaliable).

Example:

+ HKEY_CLASSES_ROOT This is what a key could look like. Assume an
| application named Information Manager (which I'm
+--+-.IFM currently developing) which saves its files with the
| extension .IFM. Under Win95 the shell, open, command
+--+-shell and ShellNew keys are of special interest. (Yes they
| can be used with Delphi as well.)
+--+-open
| |
| +---command
|
+-ShellNew

.IFM/shell/open/command defines the command to be executed when the user
double clicks on the file (or under Win95 hits the right mouse button and
selects open).

The keys alone won't do the job. Normally there are values assigned to the
keys. Under Win31 these can only be strings. Win95 defines a kind of binary
and a DWORD as well.

The shell/open/command normally has a value like:

Name Value
+ HKEY_CLASSES_ROOT
|
+--+-.IFM
|
+--+-shell
|
+--+-open
| |
| +---command (default) "H:/PROJECT/INFOMAN/IFM.EXE %1"
|
+-ShellNew

The selected filename will be substituted for '%1' and passed along as a
command-line parameter to the application. Your Delphi app can use
PARAMSTR(x) to get the x-th command line parameter. x=0 returns the full
path and name of the application itself.

If you are using the preview of Win95 and want your application to have an
entry in the 'New' popup menu (something like 'Information Manager 1.0
file'), you have to do the following:

Add a new (text) value for the ShellNew key, named NullFile, with a value
of "". Also name the extension (.IFM) equal to the entry of your app in the
registry. If the application has an entry named 'InfoMan', then name .IFM
as InfoMan.

Example:

Name Value
+ HKEY_CLASSES_ROOT
|
+--+-.IFM (default) "InfoMan"
|
+--+-shell
|
+--+-open
| |
| +---command (default) "H:/PROJECT/INFOMAN/IFM.EXE %1"
|
+-ShellNew NullFile ""

Now for the key for the application itself. (I assume the application is
still Information Manager (short: InfoMan)).

The whole tree looks like this:

Name Value
+ HKEY_CLASSES_ROOT
|
+--+-InfoMan (default) "Information Manager 1.0 File"
|
+--+-Misc
|
+--+-Options
| |
| +---Saving
| |
| +---Directories
|
+--+-shell
|
+--+-open
|
+---command (default) "H:/PROJECT/INFOMAN/IFM.EXE %1"

The Options key contains several other subkeys, which store the
application- specific settings like the window position, delete
confirmations, and others.



3. How to read and write data to the registry

Delphi offers the following API-routines for accessing the registry:

RegCreateKey()
RegOpenKey()
RegDeleteKey()
RegCloseKey()
RegEnumKey()
RegQueryValue()
RegSetValue()

NOTE: These functions are from the Win31 API. These functions can only read
and write string (PChar) values and can not set the name of a key.

Before a key can be accessed, it must be opened. The open functions return
a handle (HKEY), which is used to access the subkeys.

3.1 RegCreateKey()

Opens a key and if the key does not exist, it will be created.

function RegCreateKey(Key: HKey; SubKey: PChar; var Result: HKey): Longint;

Key:
The handle of the key which should be accessed. To write directly
under the root, you can use HKEY_CLASSES_ROOT.

SubKey:
The subkey to be accessed.

Result:
The resulting key-handle.

Returns:
ERROR_SUCCESS, if the function was successful, otherwise it will be an
error value.

3.2 RegOpenKey()

Opens an existing key. Unlike RegCreateKey, a non existing key returns an
error and will not be created.

function RegOpenKey(Key: HKey; SubKey: PChar; var Result: HKey): Longint;

Key:
The handle of the key which should be accessed. To write directly
under the root, you can use HKEY_CLASSES_ROOT.

SubKey:
The subkey to be accessed.

Result:
The resulting key-handle.

Returns:
ERROR_SUCCESS, if the function was successful, otherwise it will be an
error value.

3.3 RegSetValue()

Writes a given value to the registry. Currently only a PChar-type can be
written. To store boolean or integer values, they must be converted.

function RegSetValue(Key: HKey; SubKey: PChar; ValType: Longint; Value: PChar; cb: Longint): Longint;

Key:
The Handle of the parent key (can be HKEY_CLASSES_ROOT).

SubKey:
The subkey for which the value should be stored.

ValType:
must be REG_SZ for Win31.

Value:
The value to be stored.

cb:
Size in bytes for the Value parameter. Windows 3.1 ignores this
paramater.

Returns:
ERROR_SUCCESS if function was successful; otherwise an error is
returned.

3.4 RegQueryValue()

Reads a value from a given key (only PChar). If you want to read a boolean
or integer value, it must be converted since the Win31 registry only stores
strings.

function RegQueryValue(Key: HKey; SubKey: PChar; Value: PChar; var cb: Longint): Longint;

Key:
The Handle of the parent key (can be HKEY_CLASSES_ROOT).

SubKey:
The subkey from which the value should be read.

Value:
Pointer to a buffer, which stores the read information. Must be a
PChar.

cb:
Size of the buffer. Contains the number of chars in the buffer, after
completion of the function.

Returns:
ERROR_SUCCESS if function was successful; otherwise an error is
returned.

NOTE: The docs say, that the cb parameter is ignored for RegSetValue() and
RegQueryValue(). My experience (Using Delphi and Win95 preview) is the
contrary. Be sure alsways to set the cb parameter to the appropriate buffer
size.

3.5 RegDeleteKey()

Delets a key from the registry.

function RegDeleteKey(Key: HKey; SubKey: PChar): Longint;

Key:
The Handle of the parent key (can be HKEY_CLASSES_ROOT).

SubKey:
The subkey which should be deleted.

Returns:
ERROR_SUCCESS if the key was deleted, or ERROR_ACCESS_DENIED if the
key is in use by another application.

3.6 RegEnumKey()

Enumerates the keys for an open key.

function RegEnumKey(Key: HKey; index: Longint; Buffer: PChar; cb: Longint): Longint;

Key:
The handle of an open key (can be HKEY_CLASSES_ROOT).

index:
The index of the subkey to retrieve. Should be zero on the first call.

Buffer:
A buffer which will contain the name of the subkey when the function
returns.

cb:
The size of the buffer. Holds the number of chars copied to the buffer
after completion of the function.

Returns:
ERROR_SUCCESS if the function was successful. Otherwise an error is
returned.

NOTE: Normally an application starts the enumeration with an index value of
zero and increments it step by step.

GENERAL NOTES: HKEY_CLASSES_ROOT does not need to be opened. It is always
open and avaliable. However, using RegOpenKey() and RegCloseKey() on the
HKEY_CLASSES_ROOT will speed up performance on subsequent read/write calls.



4. An Example

So much for the theory. Here is an example. It is assumed that an
application wants to read and write the paths used for storing its data.

procedure Options.SaveSettings(Sender: TObject);
var
hndKey: HKey;
ValBuf: PChar;
cb: Longint;
begin
...
ValBuf:=StrAlloc(1024);

RegCreateKey('HKEY_CLASSES_ROOT/InfoMan/Options/Directories',hndKey);
cb:=1024;
RegSetValue(hndKey,'Working',StrPCopy(ValBuf,WorkingDir));
cb:=1024;
RegSetValue(hndKey,'Templates',StrPCopy(ValBuf,TemplateDir));
RegCloseKey(hndKey);

StrDispose(ValBuf);
end;

function GetWorkingDir: String;
var
hndKey: HKey;
ValBuf: PChar;
cb: Longint;
begin
...
ValBuf:=StrAlloc(1024);
cb:=1024;
if RegOpenKey('HKEY_CLASSES_ROOT','InfoMan/Options/Directories',hndKey) = ERROR_SUCCESS then begin
RegQueryValue(hndKey,'Working',ValBuf,cb);
GetWorkingDir:=StrPas(ValBuf);
end
else
GetWorkingDir:='C:/WINDOWS';
end;



5. Win95 features

Since you can't create a tree (or a key) for the Win95 specific features,
you might want to create a .REG file which then can be merged into the
registry using the following command:

regedit.exe /i filename.reg

The syntax of a .REG file is quite simple:

[KeyPath]
Name=Value

Name can be '@' if you want to specify it as default. Here is an example of
a .REG file:

REGEDIT4

[HKEY_CLASSES_ROOT/InfoMan]
@="Information Manager 1.0 File"

[HKEY_CLASSES_ROOT/InfoMan/Misc]

[HKEY_CLASSES_ROOT/InfoMan/Misc/RecentFiles]

[HKEY_CLASSES_ROOT/InfoMan/Misc/RecentFiles/File1]
@="H://PROJEKTE//INFOMAN//EXAMPLES//COMPUTER.IFM"

[HKEY_CLASSES_ROOT/InfoMan/Misc/RecentFiles/File2]
@=""

[HKEY_CLASSES_ROOT/InfoMan/Misc/RecentFiles/File3]
@=""

[HKEY_CLASSES_ROOT/InfoMan/Misc/RecentFiles/File4]
@=""

[HKEY_CLASSES_ROOT/InfoMan/Misc/WindowPos]

[HKEY_CLASSES_ROOT/InfoMan/Misc/WindowPos/Top]
@="97"

[HKEY_CLASSES_ROOT/InfoMan/Misc/WindowPos/Left]
@="169"

[HKEY_CLASSES_ROOT/InfoMan/Misc/WindowPos/Height]
@="590"

[HKEY_CLASSES_ROOT/InfoMan/Misc/WindowPos/Width]
@="728"

[HKEY_CLASSES_ROOT/InfoMan/Options]

[HKEY_CLASSES_ROOT/InfoMan/Options/Confirmations]

[HKEY_CLASSES_ROOT/InfoMan/Options/Confirmations/ItemRemove]
@="1"

[HKEY_CLASSES_ROOT/InfoMan/Options/Confirmations/ParentRemove]
@="1"

[HKEY_CLASSES_ROOT/InfoMan/Options/Directories]

[HKEY_CLASSES_ROOT/InfoMan/Options/Directories/Working]
@="H://PROJEKTE//INFOMAN//"

[HKEY_CLASSES_ROOT/InfoMan/Options/Directories/Templates]
@="H://PROJEKTE//INFOMAN//"

[HKEY_CLASSES_ROOT/InfoMan/Options/Directories/AutoSave]
@="H://PROJEKTE//INFOMAN//"

[HKEY_CLASSES_ROOT/InfoMan/Options/Saving]

[HKEY_CLASSES_ROOT/InfoMan/Options/Saving/AutoSave]
@="0"

[HKEY_CLASSES_ROOT/InfoMan/Options/Saving/CreateBackup]
@="1"

[HKEY_CLASSES_ROOT/InfoMan/Options/Saving/EnterFileInfo]
@="1"

[HKEY_CLASSES_ROOT/InfoMan/Options/Saving/TopicAsTitle]
@="1"

[HKEY_CLASSES_ROOT/InfoMan/shell]

[HKEY_CLASSES_ROOT/InfoMan/shell/open]

[HKEY_CLASSES_ROOT/InfoMan/shell/open/command]
@="H://PROJEKTE//INFOMAN//infoman.exe %1"



6. REGDLL.DLL

As you might have noticed by now, there is a lot of redunant programming
while accessing the registry. Therefore I've written a .DLL, that does all
the work. Along with the .DLL there is an interface unit, which exports a
TRegistry Object. With this .DLL you can read and write from the registry,
just like it would be an INI-File. This .DLL is provided as freeware as
long as the copyright notices remain intact.

See RegInt.pas for how to use the .DLL.

 
多人接受答案了。
 
后退
顶部