哪位大哥知道:installshield里修改一个键值的函数是什么?例如:我要修改[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Ma
哪位大哥知道:installshield里修改一个键值的函数是什么?例如:我要修改[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment]下的PATH的值。可是用RegDBSetKeyValueEx把PATH的值全部写成了全新的值了。哪位大哥告诉我,谢谢了!
首先 RegDBGetKeyValueEx(),得到PATH中的值,然后
szEnv1 = szEnvi+“;”+"your env";
最后 RegDBSetKeyValueEx()注意,写这个键值前,须使用 Disable(LOGGING)语句,写完后,
须使用 Enable(LOGGING)语句,省得卸载时将PATH中的东西全都删除了
哎,悉死我了!
#define TITLE "RegDBSetKeyValueEx & RegDBGetKeyValueEx" STRING szKey, szNumName, szNumValue, svNumValue, szTitle, szMsg; NUMBER nType, nSize, nvType, nvSize;#include "ifx.h"program // Create a key to test. szKey = "TestKey"; if (RegDBCreateKeyEx (szKey, "") < 0) then MessageBox ("RegDBCreateKeyEx failed.", SEVERE); abort; endif; // Set up parameters for call to RegDBSetKeyValueEx. szNumName = "TestValue"; szNumValue = "12345"; nType = REGDB_NUMBER; nSize = -1; // Set a key name and a value associated with it. if (RegDBSetKeyValueEx (szKey, szNumName, nType, szNumValue, nSize) < 0) then MessageBox ("RegDBSetKeyValueEx failed.", SEVERE); abort; else // Display what RegDBSetKeyValueEx has done. szMsg = "%s set to: %s"; SprintfBox (INFORMATION, TITLE, szMsg, szNumName, szNumValue); endif; // Retrieve key value information. if (RegDBGetKeyValueEx (szKey, szNumName, nvType, svNumValue, nvSize) < 0) then MessageBox ("RegDBGetKeyValueEx failed.", SEVERE); else // Check to see if the value returned is the same as the value set. if (nvType != REGDB_NUMBER) then MessageBox ("Type comparison failed.", SEVERE); endif; if (svNumValue != szNumValue) then MessageBox ("Subkey value comparison failed.", SEVERE); endif; // Display what RegDBGetKeyValueEx retrieved. szMsg = "%s has value: %s\n\nThis data is %d bytes."; SprintfBox (INFORMATION, TITLE, szMsg, szNumName, svNumValue, nvSize); endif; // Delete the created test key. if (RegDBDeleteKey (szKey) < 0) then MessageBox ("RegDBDeleteKey failed.", SEVERE); endif;endprogram
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); //设置根键
?
"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"也许可以得到