get device info

  • Thread starter Thread starter PCH
  • Start date Start date
P

PCH

I want to get the device name and/or description. Ie the info that is
displayed from the system popup screen in the control panel.

I tried the assembly reflection, but no luck.
 
Hi,

The owner info is held in the registry, which is why you can't find it
(took me ages to find that one out!) The key is in 'CurrentUser',
called 'ControlPanel\Owner' and the value you need is 'Owner'. It is
structured in the following way (I found this bit of info. on the web
- so thanks to who ever provided it originally).

Bytes Content
0-71 Name
72 - 143 Company Name
144 - 515 Address
516 - 565 Telephone
566 - 639 Email Address


If it's any help then here is a snippet of code that I use to pull out
the owner name (bear in mind that this is just a snippet - so you will
need to tweak it a bit!)

=)

Petit Pal.

--------------------------------------------------
Declarations:

Const c_strNoNameString As String = "Unknown"
Const c_bytLengthOfOwnerName As Byte = 72

Dim objRegistry As New Registry
Dim strOwnerInfo As String
Dim strOwnerName As String
Dim bytEndOfName As Byte

--------------------------------------------------

Code:

#If DEBUG And EMULATOR Then
Return "Emulator"
#End If

If objRegistry.GetStringValue("ControlPanel\Owner", "Owner",
strOwnerInfo) = objRegistry.ERROR_SUCCESS Then

strOwnerName = strOwnerInfo.Substring(0, 72)
bytEndOfName = Convert.ToByte(strOwnerName.IndexOf(Nothing))

If bytEndOfName > 0 Then
strOwnerName = strOwnerName.Substring(0, bytEndOfName)
End If

Return strOwnerName

Else
Return c_strNoNameString
End If
 
thx!

Petit Pal said:
Hi,

The owner info is held in the registry, which is why you can't find it
(took me ages to find that one out!) The key is in 'CurrentUser',
called 'ControlPanel\Owner' and the value you need is 'Owner'. It is
structured in the following way (I found this bit of info. on the web
- so thanks to who ever provided it originally).

Bytes Content
0-71 Name
72 - 143 Company Name
144 - 515 Address
516 - 565 Telephone
566 - 639 Email Address


If it's any help then here is a snippet of code that I use to pull out
the owner name (bear in mind that this is just a snippet - so you will
need to tweak it a bit!)

=)

Petit Pal.

--------------------------------------------------
Declarations:

Const c_strNoNameString As String = "Unknown"
Const c_bytLengthOfOwnerName As Byte = 72

Dim objRegistry As New Registry
Dim strOwnerInfo As String
Dim strOwnerName As String
Dim bytEndOfName As Byte

--------------------------------------------------

Code:

#If DEBUG And EMULATOR Then
Return "Emulator"
#End If

If objRegistry.GetStringValue("ControlPanel\Owner", "Owner",
strOwnerInfo) = objRegistry.ERROR_SUCCESS Then

strOwnerName = strOwnerInfo.Substring(0, 72)
bytEndOfName = Convert.ToByte(strOwnerName.IndexOf(Nothing))

If bytEndOfName > 0 Then
strOwnerName = strOwnerName.Substring(0, bytEndOfName)
End If

Return strOwnerName

Else
Return c_strNoNameString
End If
 
Back
Top