|
-
Jul 13th, 2011, 10:28 AM
#1
Thread Starter
Fanatic Member
Unable to use Interop. Probably being stupid
I am trying to use a 3rd-party Interop assembly called SmartWIM.
I have added it as a reference and added an Import statement
Imports SmartWIMLib
I then initilalise it with
Dim objSmartWim As New SmartWIM
All pretty standard stuff, I've done this countless times with Interops. However, whenever I try and use any methods I get the following error
Unhandled Exception: System.TypeInitializationException: The type initializer for 'VSSImage.Module1' threw an exception. ---> System.Runtime.Inte
ropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {2AA14EBC-F945-44F3-80CA-EE916BE02111} failed due to the following error: 80040154.
at VSSImage.Module1..cctor() in D:\data\willimw\Visual Studio 2010\Projects\VSSImage\VSSImage\Module1.vb:line 7
--- End of inner exception stack trace ---
at VSSImage.Module1.Main()
Last edited by Ginolard; Jul 13th, 2011 at 10:37 AM.
ManagePC - the all-in-one PC management and inventory tool
-
Jul 13th, 2011, 10:43 AM
#2
Thread Starter
Fanatic Member
Re: Unable to use Interop. Probably being stupid
Ah. Now I think I know why. The associated DLL has to be registered on the target machine too. Damn, that's annoying. Now I need to find out how to have my application register a certain DLL whilst the app is running and then unregister it at the end.
ManagePC - the all-in-one PC management and inventory tool
-
Jul 14th, 2011, 12:03 AM
#3
Re: Unable to use Interop. Probably being stupid
Yes, the Interop DLL is simply a bridge that allows your app to INTEROPerate with a COM component. That can't happen if there's no COM component to interoperate with.
You use Regsvr32.exe to register and unregister COM components. You can run it using Process.Start, just like any other program. I've never tried doing it on the fly though.
-
Jul 14th, 2011, 02:06 AM
#4
Thread Starter
Fanatic Member
Re: Unable to use Interop. Probably being stupid
Yes, I think that's what I'll have to do. It seems a little clunky but I guess I don't have much choice.
ManagePC - the all-in-one PC management and inventory tool
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|