V_UI4(&var) = 1; //DWORD类型
V_VT(&var) = VT_UI4;
iAds->Put(L"ServerAutoStart", var);//
VariantClear(&var);
iAds->SetInfo();
if(ADsGetObject(L"IIS://localhost/w3svc",IID_IADsContainer,(void**)&iContainer)==S_OK)
{
if (iContainer->GetObject(L"IIsWebServer", _bstr_t(c),(IDispatch**)&iAds)==S_OK)
{
if(iAds->QueryInterface(IID_IADsContainer,(void**)&iContainer)==S_OK)
{
////创建新站点root目录
if(iContainer->Create(L"IIsWebVirtualDir", L"Root",(IDispatch**)&iAds) == S_OK)
{
//设置新站点的根目录
V_BSTR(&var) = SysAllocString(_bstr_t(lpszSitePath));
V_VT(&var) = VT_BSTR;
iAds->Put(L"AppCreate", var);
iAds->Put(L"Path",var);
}
}
}
}
文章来源于领测软件测试网 https://www.ltesting.net/