設定機碼(Registry Key)
string keyPathString = "SOFTWARE\\AB Tool";------------------------------------------------------------------------------------------------------------------------------------
Microsoft.Win32.RegistryKey start = Microsoft.Win32.Registry.LocalMachine;
Microsoft.Win32.RegistryKey programName = start.CreateSubKey(keyPathString);
programName.SetValue("Application Path", System.Windows.Forms.Application.StartupPath);
programName.Close();
------------------------------------------------------------------------------------------------------------------------------------取得機碼(Registry Key) 的值
string pathString = null;
string keyPathString = "SOFTWARE\\AB Tool";
Microsoft.Win32.RegistryKey start = Microsoft.Win32.Registry.LocalMachine;
Microsoft.Win32.RegistryKey programName = start.OpenSubKey(keyPathString);
if (programName != null)
{
pathString = (string)programName.GetValue("Application Path");
}
沒有留言:
張貼留言