c# statusStrip 显示电脑主机名、IP地址、MAC地址
控件: ToolStripStatusLabel
主机名: Dns.GetHostName()
IP地址: Dns.GetHostAddresses(Dns.GetHostName())[0].ToString()
当前程序的版本: Assembly.GetExecutingAssembly().GetName().Version.ToString()
获取系统版本 : System.Environment.OSVersion.Version.ToString() (是电脑系统的版本)
mac地址:
ManagementObjectSearcher query =new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration") ;
ManagementObjectCollection queryCollection = query.Get();
foreach( ManagementObject mo in queryCollection )
{
if(mo["IPEnabled"].ToString() == "True")
mac = mo["MacAddress"].ToString();
}