Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Новый участник


Сообщения: 26
Благодарности: 0

Профиль | Отправить PM | Цитировать


с монитором мне уже помогли, остался серийник принтера.
модель и серийник монитора, может кому то же пригодиться:

strComputer="."
dim strarrRawEDID()
intMonitorCount=0
Const HKLM = &H80000002

Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "/root/default:StdRegProv")
sBaseKey = "SYSTEM\CurrentControlSet\Enum\DISPLAY\"

iRC = oRegistry.EnumKey(HKLM, sBaseKey, arSubKeys)
For Each sKey In arSubKeys
sBaseKey2 = sBaseKey & sKey & "\"
iRC2 = oRegistry.EnumKey(HKLM, sBaseKey2, arSubKeys2)
For Each sKey2 In arSubKeys2
oRegistry.GetMultiStringValue HKLM, sBaseKey2 & sKey2 & "\", "HardwareID", sValue
for tmpctr=0 to ubound(svalue)
if lcase(left(svalue(tmpctr),8))="monitor\" then
sBaseKey3 = sBaseKey2 & sKey2 & "\"
iRC3 = oRegistry.EnumKey(HKLM, sBaseKey3, arSubKeys3)
For Each sKey3 In arSubKeys3
if skey3="Control" then
oRegistry.GetBinaryValue HKLM, sbasekey3 & "Device Parameters\", "EDID", arrintEDID
if vartype(arrintedid) <> 8204 then
strRawEDID="EDID Not Available"
else
for each bytevalue in arrintedid
strRawEDID=strRawEDID & chr(bytevalue)
next
end if

redim preserve strarrRawEDID(intMonitorCount)
strarrRawEDID(intMonitorCount)=strRawEDID
intMonitorCount=intMonitorCount+1
end if
next
end if
next

Next
Next

dim arrMonitorInfo()
redim arrMonitorInfo(intMonitorCount-1,5)
dim location(3)
for tmpctr=0 to intMonitorCount-1
if strarrRawEDID(tmpctr) <> "EDID Not Available" then
location(0)=mid(strarrRawEDID(tmpctr),&H36+1,18)
location(1)=mid(strarrRawEDID(tmpctr),&H48+1,18)
location(2)=mid(strarrRawEDID(tmpctr),&H5a+1,18)
location(3)=mid(strarrRawEDID(tmpctr),&H6c+1,18)


strSerFind=chr(&H00) & chr(&H00) & chr(&H00) & chr(&Hff)

strMdlFind=chr(&H00) & chr(&H00) & chr(&H00) & chr(&Hfc)

intSerFoundAt=-1
intMdlFoundAt=-1
for findit = 0 to 3
if instr(location(findit),strSerFind)>0 then
intSerFoundAt=findit
end if
if instr(location(findit),strMdlFind)>0 then
intMdlFoundAt=findit
end if
next


if intSerFoundAt<>-1 then
tmp=right(location(intSerFoundAt),14)
if instr(tmp,chr(&H0a))>0 then
tmpser=trim(left(tmp,instr(tmp,chr(&H0a))-1))
else
tmpser=trim(tmp)
end if
if left(tmpser,1)=chr(0) then tmpser=right(tmpser,len(tmpser)-1)
else
tmpser="Serial Number Not Found in EDID data"
end if

if intMdlFoundAt<>-1 then
tmp=right(location(intMdlFoundAt),14)
if instr(tmp,chr(&H0a))>0 then
tmpmdl=trim(left(tmp,instr(tmp,chr(&H0a))-1))
else
tmpmdl=trim(tmp)
end if
if left(tmpmdl,1)=chr(0) then tmpmdl=right(tmpmdl,len(tmpmdl)-1)
else
tmpmdl="Model Descriptor Not Found in EDID data"
end if

tmpmfgweek=asc(mid(strarrRawEDID(tmpctr),&H10+1,1))

tmpmfgyear=(asc(mid(strarrRawEDID(tmpctr),&H11+1,1)))+1990

tmpmdt=month(dateadd("ww",tmpmfgweek,datevalue("1/1/" & tmpmfgyear))) & "/" & tmpmfgyear

tmpEDIDMajorVer=asc(mid(strarrRawEDID(tmpctr),&H12+1,1))


tmpEDIDRev=asc(mid(strarrRawEDID(tmpctr),&H13+1,1))


tmpver=chr(48+tmpEDIDMajorVer) & "." & chr(48+tmpEDIDRev)

tmpEDIDMfg=mid(strarrRawEDID(tmpctr),&H08+1,2)
Char1=0 : Char2=0 : Char3=0
Byte1=asc(left(tmpEDIDMfg,1))
Byte2=asc(right(tmpEDIDMfg,1))
if (Byte1 and 64) > 0 then Char1=Char1+16
if (Byte1 and 32) > 0 then Char1=Char1+8
if (Byte1 and 16) > 0 then Char1=Char1+4
if (Byte1 and 8) > 0 then Char1=Char1+2
if (Byte1 and 4) > 0 then Char1=Char1+1


if (Byte1 and 2) > 0 then Char2=Char2+16
if (Byte1 and 1) > 0 then Char2=Char2+8

if (Byte2 and 128) > 0 then Char2=Char2+4
if (Byte2 and 64) > 0 then Char2=Char2+2
if (Byte2 and 32) > 0 then Char2=Char2+1

Char3=Char3+(Byte2 and 16)
Char3=Char3+(Byte2 and 8)
Char3=Char3+(Byte2 and 4)
Char3=Char3+(Byte2 and 2)
Char3=Char3+(Byte2 and 1)
tmpmfg=chr(Char1+64) & chr(Char2+64) & chr(Char3+64)

tmpEDIDDev1=hex(asc(mid(strarrRawEDID(tmpctr),&H0a+1,1)))
tmpEDIDDev2=hex(asc(mid(strarrRawEDID(tmpctr),&H0b+1,1)))
if len(tmpEDIDDev1)=1 then tmpEDIDDev1="0" & tmpEDIDDev1
if len(tmpEDIDDev2)=1 then tmpEDIDDev2="0" & tmpEDIDDev2
tmpdev=tmpEDIDDev2 & tmpEDIDDev1

arrMonitorInfo(tmpctr,0)=tmpmfg
arrMonitorInfo(tmpctr,1)=tmpdev
arrMonitorInfo(tmpctr,2)=tmpmdt
arrMonitorInfo(tmpctr,3)=tmpser
arrMonitorInfo(tmpctr,4)=tmpmdl
arrMonitorInfo(tmpctr,5)=tmpver
end if
next

for tmpctr=0 to intMonitorCount-1
tf.WriteLine "Монитор;Наименование;" & arrMonitorInfo(tmpctr,0)
tf.WriteLine "Монитор;Марка;"& arrMonitorInfo(tmpctr,4)
tf.WriteLine "Монитор;Серийный номер;" & arrMonitorInfo(tmpctr,3)
next

Отправлено: 05:53, 20-04-2011 | #5