本帖最后由 ticket 于 2015-2-2 09:06 编辑
硬件侦测到的和INI内容相同但使用StringCompare比对的结果不同?
使用if的方式来判别也是不同,所以只有求助家伙喔~#include <_CompInfo.au3>
#Region ;~~ Computer Infomartion
Local $CompInf,$Ramvr, $CPUvr,$VGAvr,$i1
Local $CPURam
Local $CPUInfo = ''
$CPUInfo &= '===>CPU Information' & @CRLF
_ComputerGetOSs($CompInf)
$CompInf = StringSplit($CompInf[1][0], '|')
$CPUInfo &= 'OS: ' & @TAB & @TAB & @TAB & $CompInf[1] & @CRLF
_ComputerGetSystem($CompInf)
$CPUInfo &= 'System: ' & @TAB & @TAB & $CompInf[1][46] & @CRLF
_ComputerGetProcessors($CompInf)
$CPUInfo &= 'CPU: ' & @TAB & @TAB & @TAB & $CompInf[1][0] & @CRLF
$CPUvr =$CompInf[1][0];cpu值,要写入INI的数值
_ComputerGetMemory($CompInf)
For $i = 1 To $CompInf[0][0]
$CPURam += $CompInf[$i][2]
Next
$CPUInfo &= 'Ram: ' & @TAB & @TAB & @TAB & Round(Number($CPURam/1024^2)) & ' MB' & @CRLF
$Ramvr=$CPURam/1024^2;记忆值,要写入INI的数值
_ComputerGetVideoCards($CompInf)
For $i = 1 To $CompInf[0][0]
$CPUInfo &= 'VGA' & $i & ': ' & @TAB & @TAB & @TAB & $CompInf[$i][0] & @CRLF
$VGAvr =$CompInf[$i][0];VGA值,要写入INI的数值
Next
_ComputerGetMonitors($CompInf)
For $i = 1 To $CompInf[0][0]
$CPUInfo &= 'Monitor' & $i & ': ' & @TAB & @TAB & $CompInf[$i][21] & '*' & $CompInf[$i][20] & @CRLF
Next
#EndRegion
IniWrite("C:\Program Files\NoDrivers\enroll.ini", "处理器", "型号",$CPUvr)
IniWrite("C:\Program Files\NoDrivers\enroll.ini", "记忆体", "型号",$Ramvr)
IniWrite("C:\Program Files\NoDrivers\enroll.ini", "显色卡", "容量",$VGAvr)
Local $ini1 = IniReadSectionNames("C:\Program Files\NoDrivers\enroll.ini");读取客编号
Local $answer[3]=[$CPUvr,$Ramvr,$VGAvr]
Local $ini2 , $is=0 ,$result
For $i = 1 To $ini1[0]
; MsgBox(4096, "", "字段名:" & $ini1[$i])
$ini2 = IniReadSection("C:\Program Files\NoDrivers\enroll.ini",$ini1[$i]);读取客编号
For $i1 = 1 To $ini2[0][0]
MsgBox(4096, "", "字段名:" & $ini2[$i1][1])
$result = StringCompare($answer[$is], $ini2[$i1][1],1);侦测的型号和ini内的型号比对
MsgBox(4096, "", "字段名:" & $answer[$is]);侦测的型号
MsgBox(4096, "", "比对结果:" & $result);比对相同为0不相同为1
$is=$is+1
Next
Next
我是参考下面的内容来修改的
http://www.autoitscript.com/forum/topic/29404-computer-info-udfs/ |