**:
使用atl嚮導的話,會在resource中產生乙個rgs的註冊指令碼檔案放在"registry"目錄中用來註冊元件,會在程式中通過函式declare_registry_resourceid(idr_opcserver)使用,idr_opcserver就是嚮導產生的資源檔案的id,當伺服器呼叫ccommodule::registerserver()時,便會使用這些指令碼來載入登錄檔的設定,並在呼叫ccommodule::unregisterserver()時移除它們。所有com的註冊鍵都放在hkey_classes_root中。
例子如下
hkcr 表示登錄檔中com物件的註冊項是hkey_class_root 的縮寫
noremove表示在反註冊過程中不要刪除這層登錄檔項;forceremove表示要要完全刪除後面的項然後重新建立。msdn原文如下
string literal
description
forceremove
completely remove the following key (if it exists) and then recreate it.
noremove
do not remove the following key during unregister.
val
the followingis actually a named value.
delete
delete the following key during register.
s
the following value is a string.
d
the following value is adword.
註冊後的登錄檔主要修改如下
2、hkey_classes_root/clsid/
[hkey_classes_root/clsid/]
@="factorysoft myshell"
[hkey_classes_root/clsid//implemented categories]
[hkey_classes_root/clsid//implemented categories/]
[hkey_classes_root/clsid//implemented categories/]
[hkey_classes_root/clsid//localserver32]
@="d://temp//test//debug"
"threadingmodel"="both"
[hkey_classes_root/clsid//progid]
@="factorysoft.myshell.1"
[hkey_classes_root/clsid//versionindependentprogid]
@="factorysoft.myshell"
3、hkey_classes_root/factorysoft.myshell
[hkey_classes_root/factorysoft.myshell]
@="factorysoft myshell"
[hkey_classes_root/factorysoft.myshell/clsid]
@=""
[hkey_classes_root/factorysoft.myshell/opc]
[hkey_classes_root/factorysoft.myshell/opc/vendor]
@="factorysoft, inc"
[hkey_classes_root/factorysoft.myshell.1]
@="factorysoft myshell"
[hkey_classes_root/factorysoft.myshell.1/clsid]
@=""
5、hkey_local_machine/software/classes/clsid
[hkey_local_machine/software/classes/clsid/]
@="factorysoft myshell"
[hkey_local_machine/software/classes/clsid//implemented categories]
[hkey_local_machine/software/classes/clsid//implemented categories/]
[hkey_local_machine/software/classes/clsid//implemented categories/]
[hkey_local_machine/software/classes/clsid//localserver32]
@="d://temp//test//debug"
"threadingmodel"="both"
[hkey_local_machine/software/classes/clsid//progid]
@="factorysoft.myshell.1"
[hkey_local_machine/software/classes/clsid//versionindependentprogid]
@="factorysoft.myshell"
6、hkey_local_machine/software/classes/
[hkey_local_machine/software/classes/factorysoft.myshell]
@="factorysoft myshell"
[hkey_local_machine/software/classes/factorysoft.myshell/clsid]
@=""
[hkey_local_machine/software/classes/factorysoft.myshell/opc]
[hkey_local_machine/software/classes/factorysoft.myshell/opc/vendor]
@="factorysoft, inc"
[hkey_local_machine/software/classes/factorysoft.myshell.1]
@="factorysoft myshell"
[hkey_local_machine/software/classes/factorysoft.myshell.1/clsid]
@=""
從中可以看出s '%module%'被替換成了
@="d://temp//test//debug"程式的路徑
ATL中的RGS檔案介紹
vc的atl嚮導會生成com物件註冊用的rgs檔案。如果程式中有想寫到登錄檔中的地方,可以手工編輯這個指令碼,可以省去呼叫一堆操作登錄檔的api。關於rgs的詳細規則,msdn上面有,搜尋atl registrar這個主題即可以看到,下面只是一點簡單的介紹 hkcr 表示下面的登錄檔項都寫到hkcr...
註冊檔案型別,關聯檔案
bool function registerfiletype lpctstr houzhui,lpctstr fmiaoshu,lpctstr wmiaoshu,lpctstr filepath hkey hkey null dword dwdip 0 lptstr newreg new tchar...
某影視軟體asp註冊檔案
分析了某影視軟體。把asp檔案放在其根目錄下就可以了 1.3版本的註冊檔案reg1.3.asp,這個會自動把註冊碼寫入資料庫中 code start function getdiskid on error resume next getdiskid md5 ayang 19820504 reques...