主题
设置64位整型值 - RegistrySetQword
函数简介
设置64位整型的注册表值(REG_QWORD)。
接口名称
RegistrySetQwordDLL调用
cpp
int32_t RegistrySetQword(int64_t instance, int64_t key, const char* valueName, int64_t value);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| key | 长整数型 | 注册表键句柄,由 RegistryOpenKey 或 RegistryCreateKey 返回。 |
| valueName | 字符串 | 值名称。 |
| value | 长整数型 | 要写入的64位整型值。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
// rootKey=1 表示 HKEY_CURRENT_USER
long key = ola.RegistryCreateKey(1, "Software\\OLAPlug");
if (key != 0) {
ola.RegistrySetQword(key, "CacheSize", 1024);
ola.RegistryCloseKey(key);
}csharp
using OLAPlug;
var ola = new OLAPlugServer();
long key = ola.RegistryCreateKey(1, @"Software\OLAPlug");
if (key != 0)
{
ola.RegistrySetQword(key, "CacheSize", 1024);
ola.RegistryCloseKey(key);
}python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
key = ola.RegistryCreateKey(1, r"Software\OLAPlug")
if key != 0:
ola.RegistrySetQword(key, "CacheSize", 1024)
ola.RegistryCloseKey(key)java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
long key = ola.RegistryCreateKey(1, "Software\\OLAPlug");
if (key != 0) {
ola.RegistrySetQword(key, "CacheSize", 1024);
ola.RegistryCloseKey(key);
}cpp
var ola = com("OlaPlug.OlaSoft")
var key = ola.RegistryCreateKey(1, "Software\\OLAPlug")
if(key) {
ola.RegistrySetQword(key, "CacheSize", 1024);
ola.RegistryCloseKey(key)
}vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
key = ola.RegistryCreateKey(1, "Software\OLAPlug")
If key <> 0 Then
ola.RegistrySetQword(key, "CacheSize", 1024);
ola.RegistryCloseKey(key)
End Iftext
.局部变量 ola, OLAPlug
ola.创建 ()
key = ola.RegistryCreateKey (1, “Software\\OLAPlug“)
.如果真 (key ≠ 0)
ola.RegistrySetQword(key, "CacheSize", 1024);
ola.RegistryCloseKey (key)
.如果真结束aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var key = ola.RegistryCreateKey(1, "Software\\OLAPlug");
if(key){
ola.RegistrySetQword(key, "CacheSize", 1024);
ola.RegistryCloseKey(key);
}text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
长整数 key = ola.RegistryCreateKey(1, "Software\\OLAPlug")
如果真 (key ≠ 0)
{
ola.RegistrySetQword(key, "CacheSize", 1024);
ola.RegistryCloseKey(key)
}cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
long key = ola.RegistryCreateKey(1, "Software\\OLAPlug");
if (key != 0) {
ola.RegistrySetQword(key, "CacheSize", 1024);
ola.RegistryCloseKey(key);
}原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
long key = RegistryCreateKey(instance, 1, "Software\\OLAPlug");
if (key != 0) {
RegistrySetQword(instance, key, "CacheSize", 1024);
RegistryCloseKey(instance, key);
}csharp
using System.Runtime.InteropServices;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
long instance = CreateCOLAPlugInterFace();
long key = RegistryCreateKey(instance, 1, @"Software\OLAPlug");
if (key != 0)
{
RegistrySetQword(instance, key, "CacheSize", 1024);
RegistryCloseKey(instance, key);
}python
from ctypes import CDLL, c_int, c_int64
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
key = ola.RegistryCreateKey(instance, 1, b"Software\\OLAPlug")
if key:
RegistrySetQword(instance, key, "CacheSize", 1024);
ola.RegistryCloseKey(instance, key)返回值
| 返回值 | 说明 |
|---|---|
1 | 成功。 |
0 | 失败。 |
注意事项
| 项目 | 说明 |
|---|---|
| 如果值名称已存在 | 如果值名称已存在,将覆盖原有值。 |
| REG_QWORD 类型为64位无符号整数 | REG_QWORD 类型为64位无符号整数,范围为 0 到 18,446,744,073,709,551,615。 |
| 存储大数值 | 适用于存储大数值,如文件大小、时间戳等。 |
