HttpServerUtility.CreateObject 方法

定義

建立一個 COM 物件的伺服器實例。

多載

名稱 Description
CreateObject(String)

建立一個以 COM 物件的程式識別碼(ProgID)識別的伺服器實例。

CreateObject(Type)

建立一個以物件類型識別的 COM 物件的伺服器實例。

CreateObject(String)

建立一個以 COM 物件的程式識別碼(ProgID)識別的伺服器實例。

public:
 System::Object ^ CreateObject(System::String ^ progID);
public object CreateObject(string progID);
member this.CreateObject : string -> obj
Public Function CreateObject (progID As String) As Object

參數

progID
String

要建立實例的類別或物件類型。

傳回

新物件。

例外狀況

無法建立物件的實例。

範例

以下範例是利用物件的 ProgID 建立物件。

Object MyObject;
MyObject = Server.CreateObject("Acme.Component.3");

Dim MyObject As Object
MyObject = Server.CreateObject("Acme.Component.3")
   

另請參閱

適用於

CreateObject(Type)

建立一個以物件類型識別的 COM 物件的伺服器實例。

public:
 System::Object ^ CreateObject(Type ^ type);
public object CreateObject(Type type);
member this.CreateObject : Type -> obj
Public Function CreateObject (type As Type) As Object

參數

type
Type

A Type 代表要創造的物件。

傳回

新物件。

適用於