有个文件实际的存储目录为:
C:\Documents and Settings\All Users\Documents\RSView Enterprise\SE\HMI Projects\HMI Server 51\Gfx\testrecipe.gfx我要问的是在程序里只给了一个URL:http://localhost/rsviewse/HMI Server 51/gfx/testrecipe.gfx,怎么能通过这个URL获得上述目录?

解决方案 »

  1.   

    引用coolstar(酷星):IADsContainer*   iContainer;   
      IADs*   iAds;   
        
      /*   获得WebSever   */     
      try{   
      HRESULT   hr   =   ADsGetObject(L"IIS://localhost/w3svc",IID_IADsContainer,(void**)&iContainer);   
        
      if(!FAILED(hr))     
      {   
      //等到默认站点     
      iContainer->GetObject(_bstr_t("IIsWebServer"),   _bstr_t("1"),(IDispatch**)&iAds);   
      if(iAds->QueryInterface(IID_IADsContainer,(void**)&iContainer)==S_OK)   
      {   
      //得到默认站点的根目录   
      iContainer->GetObject(_bstr_t("IIsWebVirtualDir"),_bstr_t("Root"),(IDispatch**)&iAds);   
      //获得访问虚拟目录   
      if(iAds->QueryInterface(IID_IADsContainer,(void**)&iContainer)==S_OK)   
      {   
        
        
        
      //获得路径   
      iAds->Get(_bstr_t("Path"),_variant_t(lpszDiskPath));   
        
      iAds->Release();   
      iAds->Release();   
      iContainer->Release();   
      iContainer->Release();   
      return   TRUE;   
        
      }   
      else   
      {   
      iAds->Release();   
      iContainer->Release();   
      }   
      }   
      else   
      {   
      iAds->Release();   
      }   
      iContainer->Release();   
      }else{   
        
      strcpy(sRet,"获得WebSever出错");   
      return   false;   
        
      }
      

  2.   

    将这个网址 http://localhost/rsviewse/ 映射到C:\Documents and Settings\All Users\Documents\RSView Enterprise\SE\HMI Projects目录,如果是用ASP的话,就建立一个虚拟目录到C:\Documents and Settings\All Users\Documents\RSView Enterprise\SE\HMI Projects,站点名用rsviewse即可通过URL : http://localhost/rsviewse 访问 C:\Documents and Settings\All Users\Documents\RSView Enterprise\SE\HMI Projects,相应后面的地址就一样了。
      

  3.   

    web 相对路径转成绝对路径,只能自己来了