I've asked this question before, but I'm trying to get a Teamviewer ID from the registry and display it in a messagebox when a button has been clicked, However when I click said button, a blank message box pops up and I would like some help resolving this issue.
my code for retrieving the Teamviewer ID is below;
public static string CollectTeamviewerId()
{
var versions = new[] { "4", "5", "5.1", "6", "7", "8" }.Reverse().ToList();
foreach (var path in new[] { "SOFTWARE\\TeamViewer", "SOFTWARE\\Wow6432Node\\TeamViewer" })
{
if (Registry.LocalMachine.OpenSubKey(path) != null)
{
foreach (var version in versions)
{
var subKey = string.Format("{0}\\Version{1}", path, version);
if (Registry.LocalMachine.OpenSubKey(subKey) != null)
{
var clientID = Registry.LocalMachine.OpenSubKey(subKey).GetValue("ClientID");
if (clientID != null)
{
return clientID as string;
}
}
}
}
}
and for the button;
private void button4_Click(object sender, EventArgs e)
{
MessageBox.Show(LogDataFactory.CollectTeamviewerId());
}