LPWSTRproxyName;inton=1;if(on){proxyName=L"127.0.0.1:3125";}else{proxyName=0;}INTERNET_PER_CONN_OPTION_LISTOptionList;INTERNET_PER_CONN_OPTIONOption[3];unsignedlonglistSize=sizeof(INTERNET_PER_CONN_OPTION_LIST);Option[0].dwOption=INTERNET_PER_CONN_PROXY_SERVER;Option[1].dwOption=INTERNET_PER_CONN_FLAGS;Option[2].dwOption=INTERNET_PER_CONN_PROXY_BYPASS;OptionList.dwSize=sizeof(INTERNET_PER_CONN_OPTION_LIST);OptionList.pszConnection=NULL;OptionList.dwOptionCount=3;OptionList.dwOptionError=0;DWORDproxyType=PROXY_TYPE_DIRECT;//thisproxytypedisablesanyproxyserverif(proxyName){if(proxyName[0]){proxyType=PROXY_TYPE_PROXY;//anamehasbeenpassed,sochoosethecorrectproxytypeforenablingtheproxyserver}}Option[0].Value.pszValue=(LPWSTR)proxyName;Option[1].Value.dwValue=proxyType;if(on){Option[2].Value.pszValue=(LPWSTR)L"";}else{Option[2].Value.pszValue=(LPWSTR)L"";}OptionList.pOptions=Option;if(!InternetSetOption(0,INTERNET_OPTION_PER_CONNECTION_OPTION,&OptionList,listSize)){//handleerror}InternetSetOption(0,INTERNET_OPTION_REFRESH,NULL,NULL);=====================================================就是上边这些代码,如果写成用C#调用WinInet的,应该怎么写?
森林海
芜湖不芜
相关分类