如题
解决方案 »
- 初学C#的超级小白求前辈指点一个小问题。
- AddIn 程序中线程开启,导致无法结束进程,寻求解决方案!
- 做网页时,如何实现自动添加控件
- 关于datagridview 中的combelbox数据帮定的问题
- 求解c#中引用传递的问题
- 关于把回车存到数据库的问题
- -------一个用asp做的聊天室.时不时出"用户过多"的错误----------是什么原因呢?-----给出思路就可以了---谢谢
- TextBox 光标跟随问题求教
- 出现一个System.NullReferenceException未将对象引用设置到对象的实例问题
- 如何测试javascript客户端脚本
- 请问如何获取使用者端 Windows 联机上网事件,以便作一些事情
- +++++++用.net做网站或网页程序等如何做到模块结构????头、中间、底部可以模块化修改??
{
System.Management.ManagementClass mc = new System.Management.ManagementClass("Win32_NetworkAdapterConfiguration");
System.Management.ManagementObjectCollection moc = mc.GetInstances();
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach(ManagementObject mo in moc)
{
if((bool)mo["IPEnabled"] == true)
sb.Append(mo["MacAddress"].ToString());
mo.Dispose();
}
return(sb.ToString());
}
p.StartInfo.CreateNoWindow=true;
p.StartInfo.UseShellExecute=false;
p.StartInfo.RedirectStandardOutput=true;
p.StartInfo.FileName="ipconfig";
p.StartInfo.Arguments="/all";
p.Start();
p.WaitForExit();
string s=p.StandardOutput.ReadToEnd();
MessageBox.Show(s.Substring(s.IndexOf("Physical Address. . . . . . . . . :")+36,17));嘿嘿调用ipconfit /all产生的结果。
不过需要在项目中添加对System.Management.dll的引用