newbee Registry question

sosimple

Member
Hi. I dont know many things and i try only to read a value in registy.
The value i try to read is here
HKEY_CURRENT_USER\System\State\Phone\"Missed Call Count"
NAME =Missed Call Count
TYPE=DWORD
VALUE=0

I try this

B4X:
Sub Globals
number = 0
End Sub

Sub App_Start
      form1.Show
      reg.New1
      reg.RootKey(reg.rtCurrentUser)
      number=reg.GetValue("System\State\Phone", "Missed Call Count") 
     TextBox1.text = number
     
        Msgbox("The value is: " &  number)
End Sub

And i get a error message for line number=reg.GetValue("System\State\Phone", "Missed Call Count")
"object reference not set to an instance of an object"
I have create an object reg:Registry
Can anyone help? Thanks alot..

*** edit I put it in the phone and it worked so forget the above!!
 
Last edited:

agraham

Expert
Licensed User
Longtime User
I've cut and pasted your code and it works fine on my HTC Diamond. The normal cause for that error is that the Registry entry is not present. You are trying it on a device that actually has a phone aren't you? It is not present, for example, on my iPAQ 214 as that is not a phone.
 
Top