How to read and write value from registry in Windows CE?

Gali picture Gali · Jan 29, 2011 · Viewed 8k times · Source

How do you insert the value 1 into the property CDInsert in HKEY_LOCAL_MACHINE\SOFTWARE\WJST\WLAN and read it back?

Answer

user568493 picture user568493 · Jan 29, 2011

http://msdn.microsoft.com/en-us/library/microsoft.win32.registry%28v=VS.90%29.aspx

Try this:

//using Microsoft.Win32;

RegistryKey reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WJST\WLAN", true); 

// set value of "CDInsert" to 1
reg.SetValue("CDInsert", 1, RegistryValueKind.DWord);

// get value of "CDInsert"; return 0 if value not found
int value = (int)reg.GetValue("CDInsert", 0);