import win.ui;
import win.clip;
import math;
import process;
import win.reg;
/*DSG{{*/
var winform = win.form(parent=...; text="显示本机硬件信息小工具--Designed by VBVFP";right=600;bottom=454 )
winform.add(
button2={ bottom=382;right=346;left=233;top=357;z=6;text="复制MAC码";cls="button" };
edit={ bottom=232;right=510;left=79;multiline=1;top=153;z=1;edge=1;cls="edit" };
static={ bottom=145;text="本机硬件信息:";left=80;right=375;top=122;z=4;transparent=1;cls="static" };
static2={ bottom=308;text="本机网卡MAC:";left=83;right=197;top=293;z=5;transparent=1;cls="static" };
static4={ bottom=447;color=8421376;right=296;left=85;top=424;font=LOGFONT( name='华文楷体';h=-14;weight=700 );z=10;notify=1;text="欢迎访问aardio网站!";transparent=1;cls="static" };
static3={ bottom=45;text="计算机类型:";left=86;right=171;top=24;z=7;transparent=1;cls="static" };
edit3={ bottom=80;right=514;left=82;top=52;z=8;edge=1;cls="edit" };
button={ bottom=276;right=348;left=235;top=248;z=2;text="复制本机硬件信息";cls="button" };
static5={ bottom=444;color=16711680;right=511;left=402;top=422;font=LOGFONT( weight=700 );z=11;notify=1;text="程序设计:VBVFP";transparent=1;cls="static" };
button3={ bottom=112;text="复制计算机类型";left=238;top=88;z=9;right=351;cls="button" };
edit2={ bottom=341;right=506;left=80;top=317;z=3;edge=1;cls="edit" }
)
/*}}*/
winform.static5.oncommand = function(id,event){
//winform.msgbox( winform.static5.text );
process.execute("http://aardio.com")
}
winform.static4.oncommand = function(id,event){
//winform.msgbox( winform.static4.text );
process.execute("http://bbs.aardio.com/")
}
winform.button3.oncommand = function(id,event){
//winform.msgbox( winform.button3.text );
win.clip.write(winform.edit3.text)
}
winform.button2.oncommand = function(id,event){
//winform.msgbox( winform.button2.text );
win.clip.write(winform.edit2.text)
}
winform.button.oncommand = function(id,event){
//winform.msgbox( winform.button.text );
win.clip.write(winform.edit.text)
}
//WMI获取操作系统的信息
var str1,str2,str3,str4,str5,str6
import com
strComputer = "."
objWMIService = com.GetObject("winmgmts:{impersonationLevel=Impersonate}!\" + strComputer + "\root\cimv2")
colItems = objWMIService.ExecQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled=true",null,48)
if(colItems){
for index, item in com.each(colItems) {
str1=item.Description()//网 卡
if (string.endWith(str1,"- 数据包计划程序微型端口")){
str1=string.replace(str1,"- 数据包计划程序微型端口","")
}
winform.edit2.text=item.MACAddress()//MAC地址
}
}
wmi=com.GetObject("winmgmts:{impersonationLevel=Impersonate}!\")
var reg = win.reg("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0",true) //CPU
if (reg!==null) {
str2= reg.queryValue("ProcessorNameString")
}else{
cpus=wmi.instancesof("win32_processor")
for index, cpu in com.each(cpus) {
str2=cpu.name()+tostring(cpu.CurrentClockSpeed()/1000)+"GHz"//CPU
}
}
disks=wmi.instancesof("win32_diskdrive")
for index, disk in com.each(disks) {
str3=disk.caption()//硬盘
str4=disk.size()//容量
str4=math.modf(tonumber(str4)/10**9)+"G"
}
mem=wmi.instancesof("win32_physicalmemory")
for index, m in com.each(mem) {
str5=m.capacity()//内存
if (math.modf(tonumber(str5)/10**9)>0) {
str5="内存:"+math.modf(tonumber(str5)/10**9)+"GB"
}else{
str5="内存:"+math.modf(tonumber(str5)/10**6)+"MB"
}
}
display=wmi.instancesof("Win32_videocontroller")
for index, video in com.each(display) {
str6=video.name()//显卡
}
compu=wmi.instancesof("Win32_ComputerSystem")
for index, coms in com.each(compu) {
winform.edit3.text=coms.Manufacturer()+" "+coms.Model() //制造商和品牌
}
winform.edit.text=str1+" ; "+str2+" ; "+str3+" "+str4+" ; "+str5+" ; "+ str6
winform.show()
win.loopMessage();
return winform;