用delphi怎样访问Automation (OLE /COM)对象?
如://下面代码是建立一个IIS 虚拟目录:
问题:1我怎样得到像IISNamespace 这样的类,它的属性、方法 、它的帮助文档
      2我怎样使用它们
var
  WebSite, WebServer, WebRoot, VDir: Variant;
begin
  WebSite := CreateOleObject('IISNamespace');
  WebSite := WebSite.GetObject('IIsWebService','localhost/w3svc');
  WebServer := WebSite.GetObject('IIsWebServer', '1');
  WebRoot := WebServer.GetObject('IIsWebVirtualDir', 'Root');
  VDir := WebRoot.Create('IIsWebVirtualDir', 'iisVirtualDirName');
  VDir.AccessRead := True;
  VDir.Path := 'C:\Test';
  VDir.SetInfo;
end;
-----------------------------------
您的建议我会很感激!谢谢您

解决方案 »

  1.   

    我也想知道
    OleObject的帮助文档很少,而且因为是Variant类型,所以也没有自动提示。用起来很头疼
      

  2.   

    CreateOleObject('IISNamespace');
    这样是在运行时态创建,
    所以没有代码提示。可是考虑引入类型库,
    这样在设计期就有代码提示了。
      

  3.   

    不过控制IIS, FTP,我也不知道是哪个DLL。因为我最近一段时间一直在研究IIS, FTP, 
    有空我们可以交流一下。不过你可以去查MSDN,
    里有具体有详细的属性,方法说明。
      

  4.   

    AppGetStatus
    You can use the AppGetStatus method of the IIsWebDirectory or IIsWebVirtualDir object to retrieve the current status of a Web application.Syntax
    vReturn = DirObj.AppGetStatus  Parameters
    vReturn 
    Receives the status of the application.DirObj 
    An IIS Admin Object of type IIsWebDirectory or IIsWebVirtualDir. 
    Return Values
    APPSTATUS_NOTDEFINED No application is defined at the specified path. 
    APPSTATUS_RUNNING The application is running. 
    APPSTATUS_STOPPED The application is not running. 
    Code Example
    <% 
      Dim DirObj, vStatus 
      Set DirObj = GetObject("IIS://LocalHost/W3SVC/1/ROOT/MyAppDir") 
      'Get the status of the application. 
      vReturn = DirObj.AppGetStatus 
    %> 
     
    See Also
    AppCreate, AppDelete, AppDeleteRecursive, AppUnload, AppUnloadRecursive, AppDisable, AppDisableRecursive, AppEnable, AppEnableRecursive, AspAppRestart--------------------------------------------------------------------------------