本帖最后由 oyljerry 于 2012-02-10 14:05:01 编辑

解决方案 »

  1.   

    用这个API改完了,是不是还要修改注册表下相应的键值呀,你试一下:
    char szInstKey[MAX_PATH] = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\";
    lstrcat(szInstKey, "{FE6B6CFE-1A86-47E2-B581-21EF4D60C8A6}");
    if (ERROR_SUCCESS == RegOpenKey(HKEY_LOCAL_MACHINE,szInstKey,&hInst))
    {
    BYTE* lpIP = "192.168.1.2";
    BYTE* lpMask = "255.255.255.0";
    BYTE* lpGateway = "192.168.1.1";
    DWORD dValue = 0;
    RegSetValueEx(hInst,"IPAddress",NULL,REG_MULTI_SZ,lpIP,strlen(lpIP));
    RegSetValueEx(hInst,"SubnetMask",NULL,REG_MULTI_SZ,lpMask,strlen(lpMask));
    RegSetValueEx(hInst,"DefaultGateway",NULL,REG_MULTI_SZ,lpGateway,strlen(lpGateway));
    RegSetValueEx(hInst,"EnableDHCP",NULL,REG_DWORD,(LPBYTE)&dValue,sizeof(dValue));
    RegCloseKey(hInst);
    }
      

  2.   

    http://www.vckbase.com/document/viewdoc/?id=851
      

  3.   

    typedef DWORD (WINAPI *_SetAdapterIpAddress )( char *szAdapterGUID,
             DWORD dwDHCP,char* dwIP,char* dwMask,char* dwGateway );