Okay so I have figured out a simple solution but the problem is it might not always work; so I want to combine it with something else to make sure my applications only run on the computer that ran the application first. Basically I retrieved the host name of the computer and stored it to the application settings, then at runtime it compares the host name to the one stored in the settings page.
using System.Net.NetworkInformation;
public string GetHost()
{
IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties();
return computerProperties.HostName;
}
private Properties.Settings s = new Properties.Settings();
private void Form1_Load(object sender, EventArgs e)
{
if (s.FirstRun == true)
{
s.FirstRun = false;
s.Host = GetHost();
s.Save();
}
else if (!s.FirstRun && s.Host != GetHost())
Application.Exit();
}
So are there any more complex ways of ensuring that the application only runs on the first computer it runs on, preventing it from being passed to other computers?