如题!
类似win98下winipcfg的功能,可以用程序来修改本机ip地址,还能够把ip地址设为“自动获得”!

解决方案 »

  1.   

    http://www.codeproject.com/internet/nwset.asp
      

  2.   

    try use window API SetLocalHost
      

  3.   

    http://www.codeguru.com/internet/ipswap.html
      

  4.   

    DWORD AddIPAddress(
      IPAddr Address,     // IP address to add
      IPMask IpMask,      // subnet mask for IP address
      DWORD IfIndex,      // index of adapter
      PULONG NTEContext,  // Net Table Entry context
      PULONG NTEInstance  // Net Table Entry Instance
    );
    Parameters
    Address 
    [in] Specifies the IP address to add to the adapter. 
    IpMask 
    [in] Specifies the subnet mask for the IP address. 
    IfIndex 
    [in] Specifies the adapter to which to add the address. 
    NTEContext 
    [out] Pointer to a ULONG variable that points to the Net Table Entry (NTE) context for this IP address. The caller can later use this context in a call to DeleteIPAddress. 
    NTEInstance 
    [out] Pointer to a ULONG variable that points to the NTE instance for this IP address. 
    Return Values
    If the function succeeds, the return value is NO_ERROR.If the function fails, use FormatMessage to obtain the message string for the returned error.Res
    The IP address created by AddIPAddress is not persistent. The address exists only as long as the adapter object exists. Rebooting the computer destroys the address, as does manually resetting the network interface card (NIC). Also, certain PnP events may destroy the address.For information about the IPAddr and IPMask data types, see Win32 Simple Data Types. To convert an IP address between dotted decimal notation and IPAddr format, use the inet_addr and inet_ntoa functions.Requirements 
      Windows NT/2000 or later: Requires Windows 2000 or later.
      Windows 95/98/Me: Unsupported.
      Header: Declared in Iphlpapi.h.
      Library: Use Iphlpapi.lib.
      

  5.   

    如果不行的话请先DeleteIpAddress
    DeleteIPAddressThe DeleteIPAddress function deletes an IP address previously added using AddIPAddress.
    DWORD DeleteIPAddress(
      ULONG NTEContext
    );Parameters
    NTEContext 
    [in] Net Table Entry (NTE) context for the IP address. This context was returned by the previous call to AddIPAddress. 
    Return Values
    If the function succeeds, the return value is NO_ERROR.If the function fails, use FormatMessage to obtain the message string for the returned error.Requirements
    Client: Included in Windows XP, Windows 2000 Professional.
    Server: Included in Windows .NET Server 2003, Windows 2000 Server.
    Header: Declared in Iphlpapi.h.
    Library: Use Iphlpapi.lib.
    See Also
    IP Helper Start Page, IP Helper Function Reference, AddIPAddress