RAPI to acccess owner information on the PPC from the PC

  • Thread starter Thread starter Glyn Meek
  • Start date Start date
G

Glyn Meek

RAPI appears to have a lot of ability to get file information, files and
memory information off the PPC from the PC, but we can't find any way to get
at the 'owner' information (i.e. Name, Company, Address, Telephone, eMail
and Notes). Is there a RAPI routine we've missed, or some other way to do
this?

Glyn Meek
 
All of the owner information is contained in the registry, RAPI includes
functionality to read the device registry. See here for the code from the
device side, it should be straight-forward to convert this to use the RAPI
registry implementation - in OpenNETCF.Desktop.Communication for example.
http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=732

Peter
 
Hi,
i use this simple code for retrive the Name and set a label on the main
form.
Bye, Piergi

Declare Function CeRapiUninit Lib "rapi.dll" () As Long
Declare Function CeRapiInitEx Lib "rapi.dll" (pRapiInit As RAPIINIT) As Long
Declare Function CeRegOpenKeyEx Lib "rapi.dll" (ByVal hkey As Long, ByVal
lpSubKey As Long, ByVal ulOptions As Long, ByVal samDesired As Long,
phkResult As Long) As Long
Declare Function CeRegQueryValueEx Lib "rapi.dll" (ByVal hkey As Long, ByVal
lpValueName As Long, ByVal lpReserved As Long, lpType As Long, ByVal lpdata
As Long, lpcbData As Long) As Long
Declare Function CeRegQueryValueExLong Lib "rapi.dll" Alias
"CeRegQueryValueEx" (ByVal hkey As Long, ByVal lpValueName As Long, ByVal
lpReserved As Long, lpType As Long, lpdata As Long, lpcbData As Long) As
Long
Declare Function CeRegQueryValueExString Lib "rapi.dll" Alias
"CeRegQueryValueEx" (ByVal hkey As Long, ByVal lpValueName As Long, ByVal
lpReserved As Long, lpType As Long, ByVal lpdata As Long, lpcbData As Long)
As Long
Declare Function CeRegCloseKey Lib "rapi.dll" (ByVal hkey As Long) As Long


Function ReadCEREgistry() As Long
Dim lRet As Long
Dim phkResult As Long
Dim lpType As Long
Dim lpdata As String
Dim lpvalue As Long
Dim lpcbData As Long
Dim Data As String
Dim key As String
Dim lpdwdisposition As Long
Dim value As String

key = "Ident"
lRet = CeRegOpenKeyEx(HKEY_LOCAL_MACHINE, StrPtr(key), _
0, 0, phkResult)

If lRet <> ERROR_SUCCESS Then
'MsgBox "Failure to open key. Error: " & lret
Main.Label1.Caption = ""
Main.Label2.Caption = "Disconnesso"
Else
value = "Name"
lRet = CeRegQueryValueEx(phkResult, StrPtr(value), _
0, lpType, 0, lpcbData)
Select Case lpType
' -- For strings
Case REG_SZ:
' Allocate string space
lpdata = String(lpcbData, 0)

' Query the string value
lRet = CeRegQueryValueExString(phkResult, StrPtr(value), _
CLng(0), lpType, StrPtr(lpdata), lpcbData)

If lRet = ERROR_SUCCESS Then
Main.Label1.Caption = Left(lpdata, lpcbData - 1)
Main.Label2.Caption = "Connesso"
Else
Main.Label1.Caption = "Senza nome"
Main.Label2.Caption = "Connesso"
lpdata = ""
End If

'-- For DWORDS
Case REG_DWORD:
lRet = CeRegQueryValueExLong(phkResult, StrPtr(value), _
CLng(0), lpType, lpvalue, lpcbData)
If lRet = ERROR_SUCCESS Then MsgBox lpvalue

' -- All other data types not supported
Case Else
lRet = -1
End Select
End If

ReadCEREgistry = lRet
End Function
 
Back
Top