Notice
Recent Posts
Recent Comments
분노의 챔질
C# MACAddress 본문
반응형
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
string MACAddress = String.Empty;
foreach (ManagementObject mo in moc)
{
if (MACAddress == String.Empty) // only return MAC Address from first card
{
if ((bool)mo["IPEnabled"] == true)
MACAddress = mo["MacAddress"].ToString();
}
mo.Dispose();
}
MACAddress = MACAddress.Replace(":", "");
ManagementObjectCollection moc = mc.GetInstances();
string MACAddress = String.Empty;
foreach (ManagementObject mo in moc)
{
if (MACAddress == String.Empty) // only return MAC Address from first card
{
if ((bool)mo["IPEnabled"] == true)
MACAddress = mo["MacAddress"].ToString();
}
mo.Dispose();
}
MACAddress = MACAddress.Replace(":", "");
반응형
'Programming > C#' 카테고리의 다른 글
C# Ping Test (0) | 2010.08.24 |
---|---|
C# 역어셈블리 (0) | 2010.07.29 |
C# 중복실행방지 (0) | 2010.06.25 |
폴더 존재 유무를 판단하여 폴더 생성 (0) | 2010.06.22 |
시스템 트레이 아이콘 만들기. (0) | 2010.06.21 |