C# DLL in VC++
-
I'm trying to use a form I created in C# in a VC++ program I am creating. (Descriptive subject, no?) I have the C# compiling into a DLL and ... well that's about as far as I can get. I've done some reseach in the MSDN, and it shows how to use console classes, but nothing about how to use a form created in C#. I don't have the code on this computer, but the method I found I was trying last was using the following code (Close as I can 'member) #using //However main CLR dll is spelled. #using "MyCSharpDLL.dll" using namespace MyCSForm;//I tried it with and without this //line and it didn't work either way, so I show it. That's about where I get to. I also try to create an object of the class in the name space using either MyForm Form1; OR MyCSForm::MyForm Form1; Depending on if I use the "using namespace MyCSForm;" line or not. I have also tried to using a slightly more complex method, one that is used to load functions from a DLL. I use that method to pull things out of a C++ dll that uses dllexport to say what comes out. That method can load the C# DLL but I can't figure out what I would be trying to load from it. Tried and failed to do the form, and main and even the namespace. None worked. At least I don't know how to get them to work. Any help would be appreciated and if you have question I will answer them to the best of my abilities. And if I am going all wrong on how to load a DLL made in C# into C++, please point me in the right direction. :) Thanks. Note: I'm sorry if I seem to be flooding the forum, but I'm not sure which of the three (Visual C++, Managed C++, C#) I am posting this in would be the best place for it. Since it deals with all three of them, I believe. Thank you again for any help. The wisest of the wise may err. - Aeschylus I'm at home right now.
-
I'm trying to use a form I created in C# in a VC++ program I am creating. (Descriptive subject, no?) I have the C# compiling into a DLL and ... well that's about as far as I can get. I've done some reseach in the MSDN, and it shows how to use console classes, but nothing about how to use a form created in C#. I don't have the code on this computer, but the method I found I was trying last was using the following code (Close as I can 'member) #using //However main CLR dll is spelled. #using "MyCSharpDLL.dll" using namespace MyCSForm;//I tried it with and without this //line and it didn't work either way, so I show it. That's about where I get to. I also try to create an object of the class in the name space using either MyForm Form1; OR MyCSForm::MyForm Form1; Depending on if I use the "using namespace MyCSForm;" line or not. I have also tried to using a slightly more complex method, one that is used to load functions from a DLL. I use that method to pull things out of a C++ dll that uses dllexport to say what comes out. That method can load the C# DLL but I can't figure out what I would be trying to load from it. Tried and failed to do the form, and main and even the namespace. None worked. At least I don't know how to get them to work. Any help would be appreciated and if you have question I will answer them to the best of my abilities. And if I am going all wrong on how to load a DLL made in C# into C++, please point me in the right direction. :) Thanks. Note: I'm sorry if I seem to be flooding the forum, but I'm not sure which of the three (Visual C++, Managed C++, C#) I am posting this in would be the best place for it. Since it deals with all three of them, I believe. Thank you again for any help. The wisest of the wise may err. - Aeschylus I'm at home right now.
Do you want to use the C# form in MC++ or standard C++ application? Best regards, Paul. Jesus Christ is LOVE! Please tell somebody.
-
Do you want to use the C# form in MC++ or standard C++ application? Best regards, Paul. Jesus Christ is LOVE! Please tell somebody.
-
This would be in a standard CV++ application. The wisest of the wise may err. - Aeschylus Codito Ergo Sum - (I code, therefor I am)
Then you can only use it as an "ActiveX" control, through the COM Callable Wrapper - CCW. There is MFC sample in the MSDN demonstrating using the WinForm as MFC View. You can also read this MSDNMag artcle, which has a sample putting .NET control in MFC dialog. You can use the Type Library Exporter tool (tlbexp.exe) to generate the type libraries or the other tools and classes provided by the .NET Framework. Best regards, Paul. Jesus Christ is LOVE! Please tell somebody.