.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

.NET C# to C++ COM Obj

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :.NET Framework
I have succesfully imported the tlb for a c++ app (exe) that exposes a COM interface. tlbimp ScComm32.tlb /tlbreference:ScComm32.tlb /out:NET35ScComm32.dll /verbose Microsoft (R) .NET Framework Type Library to Assembly Converter 3.5.30729.1 Copyright (C) Microsoft Corporation. All rights reserved. Resolved referenced file 'ScComm32.tlb' to file 'C:\ace-co-devel\ScComm32\ScComm32\Release\ScComm32.tlb'. Type 'IScComm32' imported. Type 'Document' imported. Type library imported to C:\ace-co-devel\ScComm32\ScComm32\Release\NET35ScComm32.dll I added a reference to NET35ScComm32.dll to a class assembly project and can make a new COM object by doing private static DocumentClass scComm = new DocumentClass(); Creating a new DocumentClass will run the application, so I assume that I'm on the right track. I have 2 problems however. First, I don't want to run a new appliaction. I want to talk to an existing one. How can I do that? Secondly, I get an InvalidCastException ... Unable to cast COM object of type 'NET35ScComm32.DocumentClass' to interface type 'NET35ScComm32.IScComm32'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{EC08DE87-0CC5-11D4-98B9-00403399AC6C}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).  .. when I try to call

View Complete Post

More Related Resource Links

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend