Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



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

Posts: 1
Name: John Abney
Trades: 0
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
 
 
Register now for full access!
Old 06-03-2007, 11:43 PM Re: Unable to cast COM object
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Reply     « Reply to Unable to cast COM object
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.11411 seconds with 12 queries