All Forums
 Microsoft Windows CE
 General CE
 Set Owner Information programmatically?
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

davidknechtges

6 Posts

Posted - 19 May 2008 :  09:52:10  Show Profile
I need a way to set the device owner information programmatically. I see that it is stored under HKEY_CURRENT_USER\ControlPanel\Owner on my CE 5.0 device. However, this is a binary format registry key and there is conflicting information on the internet as to how this key is formatted. Some sites say the unit owner field is 72 unicode bytes, others say it is 256 bytes, so I am not sure if this is a fixed size, or if these are unicode strings separated by nulls, or what.

I have looked through Microsoft's website, and also through OpenNETCF and here, but no luck yet.

Basically, I want to replicate the functionality in the Owner properties control panel applet (but do it by reading the data from a file - so launching the control panel applet is not an option).

Thanks,

David

ctacke

877 Posts

Posted - 19 May 2008 :  10:20:51  Show Profile  Email Poster
I believe the data, stored in the values 'Owner' and 'Notes', are simply stored as binary Unicode strings. Just stuff in your data with a NULL terminator and it should work.
Go to Top of Page

davidknechtges

6 Posts

Posted - 19 May 2008 :  10:27:56  Show Profile
Thanks, but I am also looking for how to break up the owner information also into the fields shown in the control panel applet, the name, company, address, work and home phone numbers. This is what I was talking about with the conflicting information.

The notes field is all one key and that is not a problem.

David
Go to Top of Page

ctacke

877 Posts

Posted - 19 May 2008 :  16:41:50  Show Profile  Email Poster
I don't have PB installed on this machine so I can't check readily myself, but the best way to find out would be to look at the source code for the control panel applet that sets and retrieves this data, which is in the public shared source that ships with all versions of PB (including the evaluation version).
Go to Top of Page

beitman

63 Posts

Posted - 19 May 2008 :  17:47:54  Show Profile  Email Poster
#define MAX_NOTES_STRING (6*32)
#define MAX_NAME_STRING 32
#define MAX_COMPANY_STRING 32
#define MAX_ADD_STRING (4*32)
#define MAX_CC_STRING 4
#define MAX_AC_STRING 10
#define MAX_PHONE_STRING 24
Go to Top of Page

davidknechtges

6 Posts

Posted - 21 May 2008 :  14:48:58  Show Profile
Just for further notes, when reading this using managed code (C# or VB.NET), use the method:

UnicodeEncoding.Unicode.GetString().TrimEnd('\0');

(fill in the get string function with the necessary parameters based on the information in Bruce's post - keep in mind that each item also has a unicode null. For example, this would mean that the byte length of the name string would be 66; 32 TCHARs + 1 NULL).

Then, when writing to the registry key, use the method

UnicodeEncoding.Unicode.GetBytes();

and place the elements stored in it at the proper locations like was seen above for the read.

Thanks to Chris and Bruce for your help,

David

Go to Top of Page
  Topic  
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.03 seconds. Snitz Forums 2000