代码如下: void CTestDlgDlg::OnBnClickedOk() { // TODO: 在此添加控件通知处理程序代码 //OnOK(); char szBUF[1024]="" "Function ChangeWebPath(computer ,webname ,path ) /r/n" " On Error Resume Next /r/n" " Dim vRoot,websvc, site /r/n" " ChangeWebPath=-1 /r/n" " Set websvc = GetObject(/"IIS:///"&computer&/"/W3svc/") /r/n" " if (Err <> 0) Thenexit function /r/n" " for each site in websvc /r/n" "if site.class = /"IIsWebServer/" then /r/n" " if site.ServerComment = webname Then /r/n" " Set vRoot = site.GetObject(/"IIsWebVirtualDir/", /"Root/") /r/n" " vRoot.Path = path /r/n" " vRoot.SetInfo /r/n" " ChangeWebPath=0 /r/n" " exit function /r/n" " end If /r/n" "end if /r/n" " next /r/n" " End function /r/n"; CString szScript1=""; szScript1.Format("%s",szBUF); CString szScript2="z5=ChangeWebPath(/"127.0.0.1/",/"默认网站/",/"c:///") "; szScript1+=szScript2;