这个我当然清楚了呵呵 我想是做JAVA还是做。NET

解决方案 »

  1.   

    using System; 
    using System.Management; namespace ArLi.CommonPrj { 
    public class ChangeIP { /// 
    /// Build of ArLi 2003.6.3 
    /// 
    public static readonly System.Version myVersion = new System.Version(1,1); private ManagementBaseObject iObj = null; 
    private ManagementBaseObject oObj = null; 
    private ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); 
    private readonly ManagementObjectCollection moc; /// 
    /// example: 
    /// 
    /// ArLi.CommonPrj.ChangeIP o = new ArLi.CommonPrj.ChangeIP(); 
    /// string[] ipList = new string[]{"192.168.0.253","192.168.0.250"}; 
    /// string[] subnetList = new string[]{"255.255.255.0","255.255.255.0"}; 
    /// o.ChangeTo(ipList,subnetList); 
    /// 
    /// 
    public ChangeIP(){ 
    moc = mc.GetInstances(); 
    } /// cortrol 
    /// IPAddr List 
    /// subnetMask List 
    public void ChangeTo(string[] ipAddr,string[] subnetMask) { 
    foreach(ManagementObject mo in moc) { 
    if(! (bool) mo["IPEnabled"]) continue; iObj = mo.GetMethodParameters( "EnableStatic" ); 
    iObj["IPAddress"] = ipAddr; 
    iObj["SubnetMask"] = subnetMask; 
    oObj = mo.InvokeMethod("EnableStatic", iObj, null); 

    } /// cortrol 
    /// IPAddr List 
    /// subnetMask List 
    /// gateway List 
    /// gateway CostMetric List, example: 1 
    public void ChangeTo(string[] ipAddr, string[] subnetMask, string[] gateways, string[] gatewayCostMetric) { 
    foreach(ManagementObject mo in moc) { 
    if(! (bool) mo["IPEnabled"]) continue; iObj = mo.GetMethodParameters("EnableStatic"); 
    iObj["IPAddress"] = ipAddr; 
    iObj["SubnetMask"] = subnetMask; 
    oObj = mo.InvokeMethod("EnableStatic", iObj, null); iObj = mo.GetMethodParameters("SetGateways"); 
    iObj["DefaultIPGateway"] = gateways; 
    iObj["GatewayCostMetric"] = gatewayCostMetric; 
    oObj = mo.InvokeMethod("SetGateways", iObj, null); 

    } /// cortrol 
    /// IPAddr List 
    /// subnetMask List 
    /// gateway List 
    /// gateway CostMetric List, example: 1 
    /// DNSServer List 
    public void ChangeTo(string[] ipAddr, string[] subnetMask, string[] gateways, string[] gatewayCostMetric, string[] dnsServer) { 
    foreach(ManagementObject mo in moc) { 
    if(! (bool) mo["IPEnabled"]) continue; iObj = mo.GetMethodParameters("EnableStatic"); 
    iObj["IPAddress"] = ipAddr; 
    iObj["SubnetMask"] = subnetMask; 
    oObj = mo.InvokeMethod("EnableStatic", iObj, null); iObj = mo.GetMethodParameters("SetGateways"); 
    iObj["DefaultIPGateway"] = gateways; 
    iObj["GatewayCostMetric"] = gatewayCostMetric; 
    oObj = mo.InvokeMethod("SetGateways", iObj, null); iObj = mo.GetMethodParameters("SetDNSServerSearchOrder"); 
    iObj["DNSServerSearchOrder"] = dnsServer; 
    oObj = mo.InvokeMethod("SetDNSServerSearchOrder", iObj, null); 

    } /// DHCPEnabled 
    public void EnableDHCP() { 
    foreach(ManagementObject mo in moc) { 
    if(! (bool) mo["IPEnabled"]) continue; if(! (bool)mo["DHCPEnabled"]) { 
    iObj = mo.GetMethodParameters("EnableDHCP"); 
    oObj = mo.InvokeMethod("EnableDHCP", iObj, null); 




    }
      

  2.   

    要学会自己resolve自己think
    如果实在不行再问 至少你的让别知道你是思考过的 别一有问题就问
      

  3.   

    我想问都没有人啊,公司就我一个人会C#啊,其它都是DELPHI的。真是郁闷啊,,刚进公司一个星期,,
      

  4.   

    我在CSDN上问过无数问题,真正在这上面解决的少得可怜。
      

  5.   

    可以获取知识的地方很多,解决问题的方法也很多,建议你按照以下顺序解决问题:
    1、自己动手查找MSDN Library/SDK等官方文档
    2、上网google查找别人写就的文章
    3、自己多动动脑筋总结一下可能的解决方案
    4、带着自己的想法去问身边有经验的同事或者朋友
    5、到技术论坛上发贴提问,共同讨论一定要自己先动动脑子,有了自己的想法再去提问寻求帮助
      

  6.   

    我解决的办法:查一下动态帮助
    查一下MSDN
    查一下CSDN
    问一下QQ上的
    没人可问了,从网上搜索关键字 看别人的文章 
    ding