- 按键认证大神
- 2699998
- 3587
- 11
- 2173 朵
- 7386 个
- 1021 个
- 91120
- 2014-08-23
|
1#
t
T
发表于 2022-03-05 11:34
|
|只看楼主
大家在使用安卓模拟器的时候,
是不是会遇到过“未开启VT虚拟化”提示!
有没有好奇它是怎么实现检测判断的?
|
【源码分享】- 是否开启 = 检测是否开启VT虚拟化()
- If 是否开启 Then
- TracePrint "已开启VT"
- Else
- TracePrint "未开启VT"
- End If
复制代码- Function 检测是否开启VT虚拟化()
- Dim Retult, objWbemLocator, WbemServices, wbemObjectSet, SWbemObject
- Retult = False
- Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
- Set WbemServices = objWbemLocator.ConnectServer(".", "root\CIMV2")
- Set wbemObjectSet = WbemServices.ExecQuery("Select VirtualizationFirmwareEnabled From Win32_Processor")
- For Each SWbemObject In wbemObjectSet
- Retult = SWbemObject.Properties_.Item("VirtualizationFirmwareEnabled").Value
- Next
- 检测是否开启VT虚拟化 = Retult
- End Function
复制代码 【效果对比】
|