GetOwnerName

Discussion in 'Code Samples & Tips' started by alfcen, Oct 7, 2007.

  1. alfcen

    alfcen Well-Known Member Licensed User

    Hello all,
    This little routine will retrieve the Owner name registered in the Pocket PC in
    Settings/Owner Information. Requires the Registry library.

    Code:
    Sub Globals
      
    Dim buff(0As Byte
    End Sub

    Sub App_Start
      Reg.New1                                       
    'Registry object is named 'reg'
    End Sub

    Sub GetOwnerName
      
    If cPPC = false Then Return               'this is not for the desktop
      Dim m
      Reg.RootKey(Reg.rtCurrentUser)
      buff()=Reg.GetValue(
    "ControlPanel\Owner\","Owner")
      
    For i = 0 To ArrayLen(buff()) -1 Step 2
        
    If buff(i)=0 Then Exit                      'Chr(0) separates the name from other owner entries
        m = m & Chr(buff(i))
      
    Next
      
    Return m
    End Sub
     
Loading...