Reply
Unable to cast COM object
Old 06-01-2007, 02:29 PM Unable to cast COM object
Junior Talker

Posts: 1
Name: John Abney
I get the error code above when trying to execute a command line application written in VB.Net 2005. I am basically importing the Faxcomexlib.dll file to automatically fax to devices. The program works fine from most pc's, but certain pc's fail with the error above when trying to create an interface for the Faxcomexlib.faxserverclass. I have tried several things, but so far I have been unsuccessful. My latest attempt was to use the activator class instead of a direct object call in case the problem was with the unmanaged code. Here is that code:

'Activator class attempt does not work at all
Dim t As Type = Type.GetTypeFromProgID("FAXCOMEXLIB.FaxServerClass ")
Dim obj As System.Object = Activator.CreateInstance(t)
Dim objFS As IFaxServer = obj

'Standard object call that works for most PC's, but not all
Dim objFS As New FAXCOMEXLib.FaxServer

Anyone seen this error? Also, can anyone explain the use for the Activator class?
jabney27 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 06-03-2007, 10:43 PM Re: Unable to cast COM object
ForrestCroce's Avatar
Half Man, Half Amazing

Latest Blog Post:
Talapus Lake in June Snow
Posts: 3,022
Name: Forrest Croce
Location: Seattle, WA
Most people tend to write a .NET class to do their interop, but it sounds like possibly some computers with the wrong version of your fax software installed, or something like that.

Put the new FaxServer() line inside a try block.
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Reply     « Reply to Unable to cast COM object
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11957 seconds with 13 queries