急,在线等
void GetScriptMaps()
{
::CoInitialize(NULL);
IADsContainer* iContainer;
IADs* iAds;
int i=0;
VARIANT sPort;
SAFEARRAY* psa;
CString tcx;
if(ADsGetObject(L"IIS://localhost/w3svc",IID_IADsContainer,(void**)&iContainer)==S_OK)
{
iContainer->GetObject(_bstr_t("IIsWebServer"),_bstr_t("1"),(IDispatch**)&iAds);
if(iAds==NULL) return;
VariantInit(&sPort);
HRESULT hr=iAds->Get(_bstr_t("ScriptMaps"),&sPort);
if(SUCCEEDED(hr))
{
if(sPort.vt ==VT_ARRAY | VT_VARIANT)
{
VARIANT* varArray=NULL;
SafeArrayAccessData(sPort.parray,(VOID**)&varArray);
UINT uDim = SafeArrayGetDim(sPort.parray);
if(1==uDim)
{
long lLbound,lRbound;
SafeArrayGetLBound(sPort.parray,1,&lLbound);
SafeArrayGetUBound(sPort.parray,1,&lRbound);
long size = lRbound-lLbound+2;
VARIANT* tArray=NULL;
SAFEARRAYBOUND aDim[1];
aDim[0].lLbound= 0;
aDim[0].cElements= size;
psa= SafeArrayCreate(VT_VARIANT,1,aDim);
long Lbound,Rbound,index;
SafeArrayGetLBound(psa,1,&Lbound);
SafeArrayGetUBound(psa,1,&Rbound);
SafeArrayAccessData(psa,(VOID**)&tArray);
long sizeo = Rbound-Lbound+1;
index=Lbound;
for(long i=lLbound;i<=lRbound;i++)
{
if(index<sizeo)
tArray[index].bstrVal = varArray[i].bstrVal;
index++;
}
tArray[sizeo-1].bstrVal=SysAllocString "*,D:\\myprogram\\DataIN\\DLLRelll\\DataIN.dll,4,GET,POST,HEAD,TRACE"); SafeArrayUnaccessData(psa);
SafeArrayUnaccessData(sPort.parray);
}
}
}
sPort.parray = psa;
iAds->Put(_bstr_t("ScriptMaps"),sPort);
iAds->SetInfo();
iAds->Release();
iContainer->Release();
}
::CoUninitialize();
}
大家帮忙看看这段代码有什么问题.
iAds->Put(_bstr_t("ScriptMaps"),sPort);没有起作用.为什么改不了ScriptMaps的属性呢?以及有什么解决方法?
{
::CoInitialize(NULL);
IADsContainer* iContainer;
IADs* iAds;
int i=0;
VARIANT sPort;
SAFEARRAY* psa;
CString tcx;
if(ADsGetObject(L"IIS://localhost/w3svc",IID_IADsContainer,(void**)&iContainer)==S_OK)
{
iContainer->GetObject(_bstr_t("IIsWebServer"),_bstr_t("1"),(IDispatch**)&iAds);
if(iAds==NULL) return;
VariantInit(&sPort);
HRESULT hr=iAds->Get(_bstr_t("ScriptMaps"),&sPort);
if(SUCCEEDED(hr))
{
if(sPort.vt ==VT_ARRAY | VT_VARIANT)
{
VARIANT* varArray=NULL;
SafeArrayAccessData(sPort.parray,(VOID**)&varArray);
UINT uDim = SafeArrayGetDim(sPort.parray);
if(1==uDim)
{
long lLbound,lRbound;
SafeArrayGetLBound(sPort.parray,1,&lLbound);
SafeArrayGetUBound(sPort.parray,1,&lRbound);
long size = lRbound-lLbound+2;
VARIANT* tArray=NULL;
SAFEARRAYBOUND aDim[1];
aDim[0].lLbound= 0;
aDim[0].cElements= size;
psa= SafeArrayCreate(VT_VARIANT,1,aDim);
long Lbound,Rbound,index;
SafeArrayGetLBound(psa,1,&Lbound);
SafeArrayGetUBound(psa,1,&Rbound);
SafeArrayAccessData(psa,(VOID**)&tArray);
long sizeo = Rbound-Lbound+1;
index=Lbound;
for(long i=lLbound;i<=lRbound;i++)
{
if(index<sizeo)
tArray[index].bstrVal = varArray[i].bstrVal;
index++;
}
tArray[sizeo-1].bstrVal=SysAllocString "*,D:\\myprogram\\DataIN\\DLLRelll\\DataIN.dll,4,GET,POST,HEAD,TRACE"); SafeArrayUnaccessData(psa);
SafeArrayUnaccessData(sPort.parray);
}
}
}
sPort.parray = psa;
iAds->Put(_bstr_t("ScriptMaps"),sPort);
iAds->SetInfo();
iAds->Release();
iContainer->Release();
}
::CoUninitialize();
}
大家帮忙看看这段代码有什么问题.
iAds->Put(_bstr_t("ScriptMaps"),sPort);没有起作用.为什么改不了ScriptMaps的属性呢?以及有什么解决方法?
...全文
相关推荐
行业文档-设计装置-简易在线带钢急峻度测量平台.zip
【标题解析】标题"行业文档-设计装置-简易在线带钢急峻度测量平台.zip"揭示了这个压缩包文件的主要内容,它包含了关于一个特定行业的技术文档,具体是关于设计一种装置,该装置用于在线测量带钢的急峻度。"
第10招:在线等挺急的,登录密码忘了,通过配置文件重设管理员密码不好使
### 在线等挺急的,登录密码忘了,通过配置文件重设管理员密码不好使#### 概述本文档旨在解决管理员忘记登录密码时通过配置文件重设密码却失败的问题。
急采购物品请购单DOC
在压缩包中包含的文件名为“下载自www.glzy8.com管理资源吧”急采购物品请购单.DOC,这个文件名可能表示文档来源于一个在线管理资源平台,glzy8.com,这个平台可能提供了许多类似的管理工具和模板
急冷塔.rar
仪表配置涵盖多点温度热电偶(K型或S型)、压力变送器、液位计(雷达式或伺服式)、pH在线分析仪、电导率计、浊度计及流量积算仪,所有信号接入DCS系统实现闭环调节。
一种垃圾飞灰协同垃圾渗滤液的在线处置系统及其工艺的制作方法.docx
传统处理方法存在诸多局限,因此开发一种有效的在线处置系统及工艺显得尤为重要。


网络编程
