2
我正在嘗試使用c#和ASP.NET來使用COM +。我一直在關注example,但其中一部分失敗。如何獲得com +應用程序的所有com +組件的列表?
dynamic oCatalog = Activator.CreateInstance(Type.GetTypeFromProgID("ComAdmin.COMAdminCatalog"));
/* Get the Applications collection and populate it */
dynamic applicationInstances = oCatalog.GetCollection("Applications");
applicationInstances.Populate();
foreach (dynamic applicationInstance in applicationInstances)
{
Response.Write("<p>" + applicationInstance.Name.ToString() + "-" + applicationInstance.Key.ToString() + "</p>");
dynamic objComponents = oCatalog.GetCollection("Components", applicationInstance.Key);
objComponents.Populate();
foreach(dynamic Components in objComponents)
{
Response.Write("<p>" + Components.Name.ToString() + "</p>");
}
}
當上述呼叫oCatalog.GetCollection(「組件」,applicationInstance.Key)被稱爲我得到的錯誤:
System.Reflection.TargetParameterCountException: Error while invoking GetCollection.
我如何可以在應用程序獲取當前的組件列表實例?