首 页 教育新闻课件中心论文中心教学教案试题中心语文专题综合下载技术教程公务员  
设为首页
加入收藏
联系我们
您当前的位置:中国教育资源网 -> 技术教程 -> 软件开发 -> Delphi -> 技术内容 退出登录 用户管理

DELPHI和注册表Delphi教程

论文作者:佚名  论文来源:不详  论文发布时间:2006-6-19 22:36:38  论文发布人:chjchjchj

减小字体 增大字体

 

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:

         

[] [返回上一页] [打 印] [收 藏]  
 ∷相关技术评论  (评论内容只代表网友观点,与本站立场无关!) [查看发表评论...]
 
 中国教育资源网免费技术教程下载中心-站内广告 站内广告 中国教育资源网免费技术教程下载中心-站内广告 
 中国教育资源网站内搜索 站内搜索 中国教育资源网站内搜索 
 

   
 中国教育资源网免费技术教程下载中心-栏目导航 栏目导航 中国教育资源网免费技术教程下载中心-栏目导航 
· C · Delphi
· Java · vb
 
中国教育资源网免费技术教程下载中心-相关教程  相关技术 中国教育资源网免费技术教程下载中心-相关教程
· 具有不同字体的列表
· Delphi中易混淆的概
· 在Delphi中巧改窗体
· Delphi 中自做动态显
· 利用Delphi编程发送
· Delphi中怎样监视PO
· Delphi参考手册Delp
· 用Delphi 3.0编制MP
· 用Delphi制作动态有
· 用Delphi4实现风Wor
 中国教育资源网免费技术教程下载中心-本月热门教程 本月热门 中国教育资源网免费技术教程下载中心-本月热门教程 
 
 中国教育资源网免费技术教程下载中心-本日热门论文 本日热门 中国教育资源网免费技术教程下载中心-本日热门论文 
 
关于本站 - 网站帮助 - 免费课件 - 美容 - 绿色软件 - 软件下载 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 网站留言
浙ICP备06010405号 Email:cnkjz@163.com 技术支持:名流设计
版权所有 Copyright© 2002-2004 名流