By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,995 Members | 1,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,995 IT Pros & Developers. It's quick & easy.

Error with COM + 1.0 Admin Type Library (COMAdmin) interop on Win2K. 2003 works.

P: n/a
I've cross-posted this in the COM+ group as well -
apologies if that's a no-no. But the problem might be
caused by either... interop or just plain COMAdmin.

I've got a VB.NET app that is trying to access the
Component Services catalog. The first class method
installs a new component at a specified location. The
second method searches for a specified component and
deletes it.

The reference is to COM + 1.0 Admin Type Library
(COMAdmin)... located in %systemroot%\system32\com\.

The framework version on the 2003 and 2000 servers is
v1.1.4322. The application was developed for that
version (using Visual Studio .NET 2003).

This code works 100% on Windows 2003 server. When trying
to run it on Windows 2000 server, it fails with the
following error:
See the end of this message for details on invoking

just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************

System.InvalidCastException: QueryInterface for interface
COMAdmin.ICOMAdminCatalog2 failed.

at COMAdmin.COMAdminCatalogClass.GetCollection(String

SecurDOCS_COM_Utility.ComponentServicesManager.Del eteCompo
nent(String componentName, String& applicationName)

at SecurDOCS_COM_Utility.COMUtility.btnReplace_Click
(Object sender, EventArgs e)

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs

at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ButtonBase.WndProc(Message& m)

at System.Windows.Forms.Button.WndProc(Message& m)

at System.Windows.Forms.ControlNativeWindow.OnMessage
(Message& m)

at System.Windows.Forms.ControlNativeWindow.WndProc
(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Here's the class code:

=START============================================ =
Imports COMAdmin

Public Class ComponentServicesManager
Public Sub InstallComponent(ByVal componentName As
String, ByVal applicationName As String)
Dim oCatalog As New COMAdminCatalog

componentName, Nothing, Nothing)
End Sub

Public Function DeleteComponent(ByVal componentName As
String, ByRef applicationName As String) As Boolean
applicationName = ""
Dim oCatalog As New COMAdminCatalog

' Get the Applications collection and populate it.
Dim oApplications As COMAdminCatalogCollection
oApplications = CType(oCatalog.GetCollection
("Applications"), COMAdminCatalogCollection)

' Get the correct application
Dim oAppObject As COMAdminCatalogObject

For Each oAppObject In oApplications
' Get and populate the Components collection
Dim oComponents As COMAdminCatalogCollection
oComponents = CType(oApplications.GetCollection
("Components", oAppObject.Key), COMAdminCatalogCollection)

' Get the correct component
Dim oCompObject As COMAdminCatalogObject
Dim iComponentIndex As Integer = 0

For Each oCompObject In oComponents
Dim sCompDLLValue As String =

If sCompDLLValue = componentName Then
applicationName =
End If
iComponentIndex += 1

oCompObject = Nothing

If Not applicationName = "" Then
Return True
Return False
End If

oCatalog = Nothing
oApplications = Nothing
oAppObject = Nothing

End Function
End Class


I need this to work on Windows 2000 server ASAP. Any
ideas what the problem is?

Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.