write into registry
int z = 14;
string productkey="giveyourproductkey";
try
{
if (txtproductkey.Text == productkey)
{
RegistryKey softwareKey =
Registry.LocalMachine.OpenSubKey("Software", true);
RegistryKey wroxKey = softwareKey.CreateSubKey("HOTEL");
RegistryKey selfPlacingWindowKey =
wroxKey.CreateSubKey("SelfPlacingWindow");
selfPlacingWindowKey.SetValue("HT", (int)z);
selfPlacingWindowKey.SetValue("WindowState",
(object)WindowState.ToString());
MessageBox.Show("Registered Successfully,Login Now", "Hotel Taj", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
}
}
read from registry
int redComponent;
RegistryKey softwareKey =
Registry.LocalMachine.OpenSubKey("Software");
RegistryKey wroxKey = softwareKey.OpenSubKey("HOTEL");
if (wroxKey == null)
{
Productkey pr = new Productkey();
pr.Show();
return;
}
RegistryKey selfPlacingWindowKey =
wroxKey.OpenSubKey("SelfPlacingWindow");
if (selfPlacingWindowKey == null)
return;
(The above coding helps to check product key before to use windows application software)
int z = 14;
string productkey="giveyourproductkey";
try
{
if (txtproductkey.Text == productkey)
{
RegistryKey softwareKey =
Registry.LocalMachine.OpenSubKey("Software", true);
RegistryKey wroxKey = softwareKey.CreateSubKey("HOTEL");
RegistryKey selfPlacingWindowKey =
wroxKey.CreateSubKey("SelfPlacingWindow");
selfPlacingWindowKey.SetValue("HT", (int)z);
selfPlacingWindowKey.SetValue("WindowState",
(object)WindowState.ToString());
MessageBox.Show("Registered Successfully,Login Now", "Hotel Taj", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
}
}
read from registry
int redComponent;
RegistryKey softwareKey =
Registry.LocalMachine.OpenSubKey("Software");
RegistryKey wroxKey = softwareKey.OpenSubKey("HOTEL");
if (wroxKey == null)
{
Productkey pr = new Productkey();
pr.Show();
return;
}
RegistryKey selfPlacingWindowKey =
wroxKey.OpenSubKey("SelfPlacingWindow");
if (selfPlacingWindowKey == null)
return;
(The above coding helps to check product key before to use windows application software)