VC++.net & VB.Net Compatibility
-
Create a class library project in one or the other. Then in the client app. add a reference to it and an import or using statement.
Kevin
-
Create a class library project in one or the other. Then in the client app. add a reference to it and an import or using statement.
Kevin
Hi Kevin, Thank you very much, i think you are right, i can do that. But what if there is a project with a form in VB.net. can i make this form or module as a part of my VC++. net file. To be very clear, i have one module with a form in VB.net. i want this form to open when i click a button in VC++.net MDI dialog box. Is it possible? i guess not?? What about porting that form into my VC++. net MDI? Kindly help me, i hope my problem is stated well. if not kindly ask me to be clear. Thank you.
Kind Regards Sandy
-
Hi Kevin, Thank you very much, i think you are right, i can do that. But what if there is a project with a form in VB.net. can i make this form or module as a part of my VC++. net file. To be very clear, i have one module with a form in VB.net. i want this form to open when i click a button in VC++.net MDI dialog box. Is it possible? i guess not?? What about porting that form into my VC++. net MDI? Kindly help me, i hope my problem is stated well. if not kindly ask me to be clear. Thank you.
Kind Regards Sandy
Hy Sandy, I faced a similar problem, and find the solution. In my case, I created a C++ .NET Class Library with Form class and ported to C+++ Builder as an MDI Child. I absolutly sure, your problem can be solved too. Some suggestion: -Create Class library with Form class -Write a public Interface with CreateForm() method -Write a public class which expose the Interface; in the CreateForm() method create a Form and call the form Show() method; -Create a Type Library and register it with regasm.exe -Add the assembly to the GAC with gacutil.exe In the Other DEV Environment: -import type library -create an instance of the public class -Call the CreateForm() method and you'll see a form :) To resolve the MDI child problem -pass the parent handle to the childe + Call SetParent() WinAPI fuction -set the child window style to MDIShilde with the SetWindowLong() WinAPI fuction This guideline is bullshit, I know... You probably dont understand, what I mean... but I tryed. :) I guess, there is a simpler solution to your problem, because you stay in the .NET Framework... If I have some free time, I'll write a tutorial to explain everything... Till then, don't give up... -- modified at 5:13 Friday 27th October, 2006 Useful resources: MSDN .Net Interop articles Exposing .NET Components to COM By Nick Parker. http://www.codeproject.com/dotnet/nettocom.asp Understanding Classic COM Interoperability With .NET Applications By Aravind C. http://www.codeproject.com/dotnet/cominterop.asp .NET - COM Interoperability By KRISHNA PRASAD.N. http://www.codeproject.com/dotnet/COM\_DOTNET\_INTEROP.asp
-
Hy Sandy, I faced a similar problem, and find the solution. In my case, I created a C++ .NET Class Library with Form class and ported to C+++ Builder as an MDI Child. I absolutly sure, your problem can be solved too. Some suggestion: -Create Class library with Form class -Write a public Interface with CreateForm() method -Write a public class which expose the Interface; in the CreateForm() method create a Form and call the form Show() method; -Create a Type Library and register it with regasm.exe -Add the assembly to the GAC with gacutil.exe In the Other DEV Environment: -import type library -create an instance of the public class -Call the CreateForm() method and you'll see a form :) To resolve the MDI child problem -pass the parent handle to the childe + Call SetParent() WinAPI fuction -set the child window style to MDIShilde with the SetWindowLong() WinAPI fuction This guideline is bullshit, I know... You probably dont understand, what I mean... but I tryed. :) I guess, there is a simpler solution to your problem, because you stay in the .NET Framework... If I have some free time, I'll write a tutorial to explain everything... Till then, don't give up... -- modified at 5:13 Friday 27th October, 2006 Useful resources: MSDN .Net Interop articles Exposing .NET Components to COM By Nick Parker. http://www.codeproject.com/dotnet/nettocom.asp Understanding Classic COM Interoperability With .NET Applications By Aravind C. http://www.codeproject.com/dotnet/cominterop.asp .NET - COM Interoperability By KRISHNA PRASAD.N. http://www.codeproject.com/dotnet/COM\_DOTNET\_INTEROP.asp
Hi, Thanks a lot, i think this will help me a lot. I will just try this concept of yours. I am not totally clear about this concept. i may be needing your total support inorder to carry on. i will be in touch with you. hope you dont mind?
Thanks & Regards Sandy
-
Hi, Thanks a lot, i think this will help me a lot. I will just try this concept of yours. I am not totally clear about this concept. i may be needing your total support inorder to carry on. i will be in touch with you. hope you dont mind?
Thanks & Regards Sandy
Step by step: In VC++: 1. File > New Project > VC++ > CLR > Class Library 2. Right Click on the project > Add > Class Select Windows Form 3. Close Solution In VB: 1. File > New Project > VB > Windows > Windows Application 2. Switch the Form IsMdiContainer property to true 3. Add a MenuStrip to the Form 4. Insert 2 menuitem: -New VC++ Form -Window 5. Select the MenuStrip Set the MdiWindowListItem to WindowToolStripMenuItem 6. In the Solution Explorer right click on the project and Add Referece Go to the Browse tab and find the VC++ dll 7. In 'New VC++ Form' menuitem click event: Dim CppForm As Object CppForm = New VCpp_Form.Form1 CppForm.MdiParent = Me CppForm.Show() Other notes: -It works vice versa. (VB -> VC++) -It is also possible to port the .NET window to other Dev. Environment, but if you leave the .NET Framework it is more complicated than the specific example. Such as I embedded the VC++ Form to the C++ Builder 6, but I'm absolutely sure it works with MFC, VB 6, etc.