|
|
@@ -609,7 +609,6 @@ void CSystem::HideSystemKeyboard()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 递归遍历PNP树,查找是否存在BTH\开头的蓝牙硬件子设备
|
|
|
// 递归遍历PNP树,查找是否存在BTH\开头的蓝牙硬件子设备
|
|
|
static bool HasBluetoothChildDevice(HDEVINFO hDevInfo, SP_DEVINFO_DATA* parentDevInfo)
|
|
|
{
|
|
|
@@ -830,7 +829,7 @@ bool CSystem::HasKeyboardDevice()
|
|
|
if (ret == (UINT)-1)
|
|
|
return false;
|
|
|
|
|
|
- std::unordered_set<std::wstring> uniqueUsbId;
|
|
|
+ bool hasRealKeyboard = false; // 和ShowKeyboardDeviceNames保持一致:用布尔标记
|
|
|
|
|
|
for (UINT i = 0; i < deviceCount; i++)
|
|
|
{
|
|
|
@@ -851,34 +850,20 @@ bool CSystem::HasKeyboardDevice()
|
|
|
if (zeroPos != std::wstring::npos)
|
|
|
devPath.resize(zeroPos);
|
|
|
|
|
|
- // 2. 调用IsRealPhysicalKeyboard,传入路径;调试输出传nullptr(不需要调试就传nullptr)
|
|
|
+ // 2. 调用IsRealPhysicalKeyboard,传入路径
|
|
|
std::wstring itemDebug;
|
|
|
- if (!IsRealPhysicalKeyboard(devPath.c_str(), &itemDebug))
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- // 3. 提取uniqueId,保留你原来的解析逻辑
|
|
|
- std::wstring uniqueId;
|
|
|
- size_t usbTag = devPath.find(L"#7&");
|
|
|
- if (usbTag != std::wstring::npos)
|
|
|
- {
|
|
|
- size_t endTag = devPath.find(L"&0&", usbTag);
|
|
|
- if (endTag != std::wstring::npos)
|
|
|
- uniqueId = devPath.substr(0, endTag);
|
|
|
- }
|
|
|
- if (devPath.find(L"Microsoft Keyboard RID") != std::wstring::npos)
|
|
|
- {
|
|
|
- uniqueId = L"BT_KB";
|
|
|
- }
|
|
|
+ bool realKb = IsRealPhysicalKeyboard(devPath.c_str(), &itemDebug);
|
|
|
|
|
|
- if (!uniqueId.empty())
|
|
|
+ if (realKb)
|
|
|
{
|
|
|
- uniqueUsbId.insert(uniqueId);
|
|
|
+ hasRealKeyboard = true; // 只要有一个真实键盘就置true,与弹窗逻辑完全对齐
|
|
|
+
|
|
|
+ break; // 找到一个真实键盘就可以退出循环
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return uniqueUsbId.size() > 0;
|
|
|
+ // 返回值完全对齐ShowKeyboardDeviceNames:只要IsRealPhysicalKeyboard有一个为true就返回true
|
|
|
+ return hasRealKeyboard;
|
|
|
}
|
|
|
|
|
|
void CSystem::ShowKeyboardDeviceNames()
|