注册表操作
HKEY hKey = nullptr;if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\services\\NetBT\\Parameters"), 0, KEY_WRITE, &hKey))
{AfxMessageBox(L"打開注冊表失敗");return;
}if (nDigits == 64)
{
//? if (ERROR_SUCCESS != RegCreateKey(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\services\\NetBT\\Parameters\\SMBDeviceEnabled"), &hKey))
//? {
//? AfxMessageBox(L"創建注冊表失敗");
//? return;
//? }if (ERROR_SUCCESS != RegSetValueEx(hKey, L"SMBDeviceEnabled", 0, REG_QWORD, (BYTE*)&nQword, sizeof(QWORD))){AfxMessageBox(L"寫入注冊表失敗");return;}
}
else if (nDigits == 32)
{if (ERROR_SUCCESS != RegSetValueEx(hKey, L"SMBDeviceEnabled", 0, REG_QWORD, (BYTE*)&nDword, sizeof(DWORD))){AfxMessageBox(L"寫入注冊表失敗");return;}
}
RegCloseKey(hKey);
?
總結
- 上一篇: Android Studio 3.1.4
- 下一篇: 树:二叉树的层序遍历算法(超简洁实现及详