本文整理汇总了Java中com.sun.jna.platform.win32.Advapi32Util.registrySetStringValue方法的典型用法代码示例。如果您正苦于以下问题:Java Advapi32Util.registrySetStringValue方法的具体用法?Java Advapi32Util.registrySetStringValue怎么用?Java Advapi32Util.registrySetStringValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jna.platform.win32.Advapi32Util
的用法示例。
在下文中一共展示了Advapi32Util.registrySetStringValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setStringValue
import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
/**
* Applies a String(REG_SZ) value on the specified key.
*
* The key will be created if does not exist.
* The key type will be changed if needed.
*
* @param keyPath
* @param keyName
* @param keyValue
*/
@Override
public void setStringValue(
String rootKey,
String keyPath,
String keyName,
String keyValue ) {
log.info("Set String value '" + keyValue + "' on: " + getDescription(rootKey, keyPath, keyName));
try {
Advapi32Util.registrySetStringValue(getHKey(rootKey), keyPath, keyName, keyValue);
} catch (RuntimeException re) {
throw new RegistryOperationsException("Couldn't set registry String value '" + keyValue
+ "' to: "
+ getDescription(rootKey, keyPath, keyName),
re);
}
}
示例2: createRegistryEntry
import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
public static void createRegistryEntry(String path, String valueName, String value) throws
RegistryCanNotWriteInfoException {
try {
SETTINGS.setProperty(valueName, value);
Advapi32Util.registrySetStringValue(APP_ROOT_HKEY, path, valueName, value);
} catch (Win32Exception e) {
throw new RegistryCanNotWriteInfoException("Can not create entry at: "
+ APP_ROOT_HKEY + "\\" + path + valueName
+ " With value [" + value + "]", e);
}
}