|
 |
|
|
 |
|
|
How do you debug this code? Lets say from my C++ client, from where I create this .NET object and then call the MessageBox.Show() function. If I place a break point in the C++ code how do I trace it to the .NET function
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
'namespace::interfaceName' : cannot instantiate abstract class ... .. HRESULT IUnknown::QueryInterface(const IID &,void **)' : is abstract etc etc
If someone get these errors on compiling Call_CSharp_COM.cpp, then replace _tmain() body with this one...
CoInitialize(NULL); //Initialize all COM Components CComPtr<namespaceName::interfaceName> pPtr; HRESULT hr = pPtr.CoCreateInstance(namespaceName::CLSID_classname);
if (hr == S_OK) { pPtr->ShowDialog(); //call .NET COM exported function ShowDialog () }
CoUninitialize (); //DeInitialize all COM Components
Hope it helps.
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions. ..surviving in autumn..in love with spring..
modified on Friday, July 4, 2008 10:32 AM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
i followed the example and did some of the corrections (lyk making the interface public, set Register for COM Interop to TRUE, etc.) but still im not able to run the console application...when i compiled the it, i got these errors:
error C2039: 'CLSID_MyDotNetClass' : is not a member of 'MyInterop' error C2065: 'CLSID_MyDotNetClass' : undeclared indentifier
has anyone run into this problem?
tnx
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
it should be CreateInstance("namespace.classname"). stepping into CreateInstance, you will know what it needs.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
After compling this #import “<Full Path>\com.MyInterop.tlb" named_guids raw_interfaces_only
com.MyInterop.tlb file is not getting created
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I'm geting Cryptographic failure while signing assembly 'C:\Documents and Settings\joxyej\Desktop\ManagedCOM\ManagedCOM\MyInterop\obj\Debug\MyInterop.dll' -- 'Error reading key file 'MyKeyPair.snk' -- The system cannot find the file specified. '
error ...pls help
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
For some reason the compliler says that the CLSID_MyDotNetClass is undefined in the following line:
pDotNetCOMPtr.CreateInstance(MyInterop::CLSID_MyDotNetClass);
Has anyone run into this problem?
Thx
|
| Sign In·View Thread·PermaLink | 1.25/5 (4 votes) |
|
|
|
 |
|
|
 |
|
|
I have created a C# Class Library(MyInterop.dll) for COM Interop. I have COM dll where in i need to retrieve the CLSID using LoadTypeLib() followed by GetTypeAttr()
LoadTypeLib("MyInterop.dll", &typeLib); typeInfo->GetTypeAttr(&typeAttr); clsid = typeAttr->guid;
But the call to LoadTypeLib returns TYPE_E_CANTLOADLIBRARY.
(Pls note that i dont want to use #import .tlb")
Your help is appreciated Thanks
|
| Sign In·View Thread·PermaLink | 1.50/5 (2 votes) |
|
|
|
 |
|
|
It won't work, if your .NET component makes use of .NET licensing, and most commercial ones do, because it this case the client must be signed as well. Getting C++ application signed seems tricky. Do you know how to do it? Too bad you didn't cover it here...
Free C++ libraries with source code on www.neatcpp.com: TWAIN, DirectShow, Interprocess Communications, etc...
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I did as the above steps. But when I run the samples, the "CreateInstance()" shows that the class is not registered. Why ? Is there anyone who can help me out?
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
After a full days searching and reading this is what fixed it for me.
Changed build events to read.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\gacutil.exe /i "$(TargetPath)" C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe "$(TargetPath)" /tlb:"$(TargetDir)com.MyInterop.tlb" /codebase
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Hi, I have the same problem, but the solution does not work for me. Any body have a working solution using VS2005? Please give some detailed steps. Thanks a lot!!!
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
Hi all,
I also have the problem, that my class seems to be not registered in the right way. When I call CreateInstace, it says: class not registered. I use Fwk 2.0, used gacutil.exe and regasm.exe in v2.0 and registered them according to the instruction given in the article.
In my class however, there are members and constructor-calls of other classes, which were NOT registered for COM (ComVisible(false)).
Could it be, that I mustn't uses those members and classes in my COM class?
Thanks for your reply, beni
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
Found this while looking for more information on the topic. Hope others find it useful as well: http://support.microsoft.com/kb/828736
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
I've followed the fixes posted in previous comments, and have gotten it to compile in VS2005. However, I can't get the dialog to appear. When debugging, it seems hRes, instead of being S_OK, gets assigned E_NOINTERFACE, and the ShowCOMDialog() method is never called.
Any ideas what I did wrong?
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
Hello all, I am trying to access some methods/algorithms in c# from c++ code. I followed the examples in this page, however when I try to build the c++ code I get an error indicating that it cannot open "c:\...\...Debug\com.MyInterop.tlb" can somebody expound on the examples on this page (or give a new step-by- step walktgrough as to how I can do this.
Regards and Thanks mistikh
|
| Sign In·View Thread·PermaLink | 2.17/5 (5 votes) |
|
|
|
 |
|
|
I need more article and resource on this issue. Plese help me providing some link.
Thanks
nzhuda@gmail.com
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
The Interface & Class Should be made public otherwise the type information for them will not be generated. And the GUID is not required. I tried without them and it works.
namespace MyInterop { public interface IMyDotNetInterface { void ShowCOMDialog(); } [ClassInterface(ClassInterfaceType.None)] public class MyDotNetClass : IMyDotNetInterface { // Need a public default constructor for COM Interop. public MyDotNetClass() {} public void ShowCOMDialog() { System.Windows.Forms.MessageBox.Show(“I am a" + " Managed DotNET C# COM Object Dialog”); } } }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi All,
Is there will be any memory leaks, because we r using mananged dll in Unmanaged code. is there any steps take care??
Thanks in Advance.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Just wanted to say thankyou. I've been wanting to do this for sometime but couldn't figure it out. Thanks also to Jonas and Pas Rao for the VS2005 update.
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Hi,
Thanks for the article.
I want my c# com method to return a collection of custom objects. The generated tlh file says that the argument to the method is :
/*[out,retval]*/ struct IEnumerable * * pRetVal
How do I use this in unmanaged c++
Marcel
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
;PWas very useful your code, but what about the pass of parameters??? Also the corrections made by others forum users about VS2005.
P;P;P;P;P
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hello Atul thanks for sharing,
Where do I find an example of client COM in Visual C++ 6, for receaving event from assembly.Net? I found many client in VB6 but not in Visual C++ 6. Thanks
andrea rossettini
|
| Sign In·View Thread·PermaLink | 3.50/5 (2 votes) |
|
|
|
 |