loading a COM object dynamically?

  • Thread starter Thread starter giddy
  • Start date Start date
G

giddy

hi,

I'm using OCR in my application. Its not a feature my users can't live
without. I need office 2003+ installed.

So instead of referencing the MODI library, i want to late bind it? In
other words check which exists and then use it.

Is this even possible?!

Gideon
 
Gideon,

Well, regardless of whether or not it is installed, you should have a
reference to the interop assembly that you are going to use to access it.
Then, when you want to check to see if the appropriate library is installed,
just try to create an instance of your class. Wrap that in a try/catch
handler. If you get an exception, then the product is not installed
properly, and your program can act accordingly.
 
hi Nicholas.,

Do you mean i should early bind it(add reference) ? An interop
assembly is created when i do.

So my app wont crash/throw exceptions if it doesn't find a reference?
It only will throw an exception when i create an instance of the
class? Cool. ;)

Thanks.

Gideon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top