Device ID

Smee

Well-Known Member
Licensed User
Longtime User
i have read the threads here
http://www.b4x.com/forum/questions-help-needed/3678-device-id.html
and tried the code to read the registry

path="HKEY_LOCAL_MACHINE\Ident\Name"
device_ID = reg.GetValue(PATH, REG_SZ)

and also getdeviceid

The code was this
Dim ID,IDparts(0)

hw.New1
ID=hw.GetDeviceID
IDparts() = StrSplit(ID, "-")
Msgbox(HexToString(IDparts(4)))
However all i get is unreadable characters

Can anyone advise what is wrong?

Thanks

Joe
 

ceaser

Active Member
Licensed User
Hi Smee

Try this:

Hardware1.New1
msgbox(SubString(Hardware1.GetDeviceID,0,8))

Regards
Michael
 

Smee

Well-Known Member
Licensed User
Longtime User
hi ceaser

i tried that and the response was E6461300 so i converted thus

Msgbox(HexToString(SubString(Hw.GetDeviceID,0,8)))
and i got the following aeF followed by a square box like the tab character

thanks

Joe

i should say i set the device name in the deviceid tab of about. No description is used
 
Last edited:

Smee

Well-Known Member
Licensed User
Longtime User
If you want the device name set in About then look at HKEY_LOCAL_MACHINE\Ident\Name.

Hello Andrew,

I have tried several permutations of trying to retrieve the name but all unsuccesfully.

this is the latest attempt
Reg.New1
reg.RootKey(reg.rtCurrentUser)
key = "HKEY_LOCAL_MACHINE\Ident\Name"
name = reg.GetValue(key, "Name")
Msgbox(name)

next i tried

If cPPC = True Then
Reg.New1
reg.RootKey(reg.rtLocalMachine)
key="Ident\Name"
name = reg.GetValue(key, "Name")
Msgbox(name)
End If

and this

If cPPC = True Then
Reg.New1
reg.RootKey(reg.rtLocalMachine)
key="HKEY_LOCAL_MACHINE\Ident\Name"
name = reg.GetValue(key, "Name")
Msgbox(name)
End If

and this

If cPPC = True Then
Reg.New1
key="HKEY_LOCAL_MACHINE\Ident\Name"
name = reg.GetValue(key, "Name")
Msgbox(name)
End If

but i get the same error message "an error occured retreiving the registry key"

Is there any code i could copy?

thanks

Joe
 
Last edited:

Smee

Well-Known Member
Licensed User
Longtime User
Ahhhhhh so easy when you know the correct syntax and know how

:)

Thank you Taximania

Joe
 
Top