共用方式為


IServer::CreateObject

The IServer::CreateObject method creates an instance of a server component. For more information, see the Server.CreateObject method of the Server object.

HRESULT CreateObject(
      BSTR bstrProgID,
      IDispatch** ppDispObject
);

Parameters

  • bstrProgID
    [in] A BSTR that contains the progID of the object.

  • ppDispObject
    [retval] [out] Points to an IDispatch interface pointer.

Remarks

By default, objects created by the Server.CreateObject method have page scope. This means that they are automatically destroyed by the server when it finishes processing the current ASP page.

To create an object with session or application scope, you can either use the <OBJECT> tag and set the SCOPE attribute to SESSION or APPLICATION, or store the object in a session or application variable.

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

See Also