This post shows a simple example how to read and update the name of the device - which is stored in the registry.
I've written a simple bit of code that looks like the following:
using Microsoft.Win32;
public partial class Form1 : FormThe form looks like the following:
{
private const string IDENTITY = @"HKEY_LOCAL_MACHINE\Ident";
private const string NAME = "Name";
public Form1()
{
InitializeComponent();
}
private void apply_Click(object sender, EventArgs e)
{
Registry.SetValue(IDENTITY, NAME, deviceName.Text);
}
private void Form1_Load(object sender, EventArgs e)
{
deviceName.Text = (string)Registry.GetValue(IDENTITY, NAME, "NAME");
}
}
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6lKImOZtkcQ4zzZXb2aWj1EjLktmDjJ1z2g6Ofjmvxb0k57nFkGhOChaAekBlJ2rGpgeXaO8xxIACCw4kfjZvaxWCZztinbXLdS9Ceag7lY9suj7ptoCnWPY0ltyzHqFTUyc/s400/devicename.jpg)
Mobile app pre-change
This can also been seen from the Settings\System\About\Device ID applet:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOR58OOjTJKjMEqgMYHLKGTIJf41hrpIqQnWpo7eGTGh0W_VqKyIZeGAR7mk8u55oVwSCSjjJURhWwmVVoAeVvvIhDZ0taFBGOkeTzj_lPAYsvj9zxVyvt6se0OO3X7nz-uxo/s400/devicename+-+settings.jpg)
Device name pre-change
Also this can be seen via the Windows CE Remote Registry Editor (CE Remote Tools):
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvxoLo_TeEeTaHaoa9zaOzOj6gT5ychSDT_Lre_66LKwn_4DWNPGU2LEUAkM-pRxKoL0JTj9wrOoWDYrszSx1QEBrHPPBr2smALs9czsQe24NoACYRGOVurfnTnhhFbjLpflk/s400/devicename+-+registry+viewer.jpg)
Now we simply change the "MyDevice" to "NewDeviceName" and click the Apply button. Our change is propagated instantly if we go and check the settings applet again:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivzdYe0q30D2M6k78atzoENn0SlzPqH0LZmg5cVuyNmDiGGrVme0T-fRVsaACZixx6sTPNQ53IhQ4xk8Ehz_zfbU9-UighYIOdJNGesl-DoT6YULa_r60nMsoRHMn3tikSbBU/s400/devicename+-+settings+post.jpg)
It's as simple as that!
No comments:
Post a Comment