LODOP不仅是web打印的组件同时还集成了很多一般web页面用JS调取不到的关于硬件系统参数的获取功能,如获取客户端系统信息如MAC地址、CPU序列号、BIOS序列号、硬盘序列号、主板序列号等功能。
Lodop提供了一个读取客户端系统信息的函数,其格式如下:
LODOP.GET_SYSTEM_INFO(strINFOType);
参数strINFOType说明:
该参数大多是“设备类型”和“设备属性”的名称组合,用“.”号联结。当有多个同类设备存在时,类型名后加“点和序号”来指定某设备。设备类型和属性名称见WMI(MicrosoftWindows管理规范)。
一、演示获得部分设备信息:
<input type="button" value="所有驱动的盘符:"
onclick="document.getElementById('T1').value=getSystemInfo('Drive.Labels',document.getElementById('T1'))"><input type="text" id="T1" size="48"><br>
<input type="button" value="第一个硬盘的盘符:"
onclick="document.getElementById('T2').value=getSystemInfo('DiskDrive.1.Label',document.getElementById('T2'))"><input type="text" id="T2" size="45"><br>
<input type="button" value="第一个光盘的盘符:"
onclick="document.getElementById('T3').value=getSystemInfo('CDROMDrive.1.Label',document.getElementById('T3'))"><input type="text" id="T3" size="45"><br>
<input type="button" value="第一个优盘的盘符:"
onclick="document.getElementById('T4').value=getSystemInfo('RemovableDrive.1.Label',document.getElementById('T4'))"><input type="text" id="T4" size="45"><br>
<input type="button" value="主硬盘的序列号:"
onclick="document.getElementById('T5').value=getSystemInfo('DiskDrive.1.SerialNumber',document.getElementById('T5'))"><input type="text" id="T5" size="47">
<br>
<input type="button" value="主网卡MAC地址:"
onclick="document.getElementById('T6').value=getSystemInfo('NetworkAdapter.1.PhysicalAddress',document.getElementById('T6'))"><input type="text" id="T6" size="48">
<br>
<input type="button" value="主网卡IP地址:"
onclick="document.getElementById('T7').value=getSystemInfo('NetworkAdapter.1.IPAddress',document.getElementById('T7'))"><input type="text" id="T7" size="49">
<br>
<input type="button" value="主网卡Mask"
onclick="document.getElementById('T8').value=getSystemInfo('NetworkAdapter.1.SubnetMask',document.getElementById('T8'))"><input type="text" id="T8" size="53">
<br>
<input type="button" value="网卡个数:"
onclick="document.getElementById('T9').value=getSystemInfo('NetworkAdapter.Count',document.getElementById('T9'))">
<input type="text" id="T9" size="54"><br>
<input type="button" value="所有MAC地址:"
onclick="getAllMac(document.getElementById('textarea01'))"><br>
<textarea rows="3" id="textarea01" cols="65"></textarea>
<br>
<input type="button" value="硬盘个数:"
onclick="document.getElementById('T10').value=getSystemInfo('DiskDrive.Count',document.getElementById('T10'))"><input type="text" id="T10" size="54">
<br>
<input type="button" value="CPU序列号:"
onclick="document.getElementById('T11').value=getSystemInfo('Processor.CPUID',document.getElementById('T11'))"><input type="text" id="T11" size="52">
<br>
<input type="button" value="BIOS序列号:"
onclick="document.getElementById('T12').value=getSystemInfo('BIOS.SerialNumber',document.getElementById('T12'))"><input type="text" id="T12" size="51">
<br>
<input type="button" value="主板序列号:"
onclick="document.getElementById('T13').value=getSystemInfo('BaseBoard.SerialNumber',document.getElementById('T13'))"><input type="text" id="T13" size="51">
二、相关LODOP功能的JS代码
<script language="javascript">
var LODOP; //声明为全局变量
function getSystemInfo(strINFOType,oResultOB){
LODOP=getLodop();
if (LODOP.CVERSION) CLODOP.On_Return=function(TaskID,Value){if (oResultOB) oResultOB.value=Value;};
var strResult=LODOP.GET_SYSTEM_INFO(strINFOType);
if (!LODOP.CVERSION) return strResult; else return "";
}
function getAllMac(oResultOB){
LODOP=getLodop();
if (!oResultOB) return;
oResultOB.value="";
if (LODOP.CVERSION) {
CLODOP.On_Return=function(TaskID,Value){
if (Value>0) {
for (i=1; i <=Value; i++) {
CLODOP.On_Return=function(TaskID,Value){oResultOB.value=oResultOB.value+Value+"; "};
CLODOP.On_Return_Remain=true;
CLODOP.GET_SYSTEM_INFO("NetworkAdapter."+i+".PhysicalAddress");
}
}
};
LODOP.GET_SYSTEM_INFO("NetworkAdapter.Count");
} else {
var CountValue=LODOP.GET_SYSTEM_INFO("NetworkAdapter.Count");
for (i=1; i <=CountValue; i++) {
oResultOB.value=oResultOB.value+LODOP.GET_SYSTEM_INFO("NetworkAdapter."+i+".PhysicalAddress")+"; ";
}
}
}
</script>
以上就是LODOP获取客户端系统信息如MAC地址、CPU序列号的详细内容,更多关于LODOP获取客户端系统信息如MAC地址、CPU序列号的资料请关注九品源码其它相关文章!