Click here to Skip to main content
15,885,933 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi All,

I have created ATL project which adds the context menu to the windows explorer and the doing some work and the output as dll. I registered the dll this was reflected in my windows explorer. Front view of my application is windows form that is UI. Please help me. how to include the form as front view and getting the input from the user. Then internally, input of the form is passed to atl project also.
is it possible.
I saw msdn forum, they faced the same issue i.e., they created class library project then add the windows form class in vc++ and the output as dll. Then this dll was added to atl project using references. But i dont know how to create/invoke the form object with in class library project in vc++.


Please help me, I am waiting for your response.

Thank you,
K.Prathika
Posted

1 solution

Use C++/CLI. E.g., use gcnew to instantiate a .NET class and then use the object in your C++ code.

A similar question was asked in CP a few days back. Check the answers there:
call c# dll or class within c++ project[^]
 
Share this answer
 
Comments
prathikasaravanan 26-Oct-12 2:28am    
Hi manoranjan,
I have created vc++ project clr->class library then add the windows form class to this project. I have created object like Form1 f =gcnew Form1(); in the class "class library". But it says "class does not have a copy-constructor" error message. I am not working on C# windows form. I am using VC++ windows form application.
Please help me.

Thank you,
K.Prathika
manoranjan 26-Oct-12 3:19am    
Check if your Form1 class defines an empty constructor. Secondly, do not use parenthesis. See MSDN for details. It also provides a sample: http://msdn.microsoft.com/en-us/library/system.windows.forms.form.form.aspx#Y124
prathikasaravanan 26-Oct-12 3:28am    
Hi Manoranjan,
Thank you for your immediate response. I have created CLR-->ClassLibrary project, then right click the project from the solution explorer and add the new item and select the Windows Form. This class give header and cpp file for Form, here form class is ref class, if i create the object for Form class from library project that is nothing but empty class. It says error message error C2065: 'Form1' : undeclared identifier

Please help, I am waiting for your response. I am new to VC++

Thank you,
K.Prathika
manoranjan 26-Oct-12 3:52am    
Since you have not shared the code, I cannot say what the problem could be. Perhaps, you have used Form1 without namespace (e.g. System::Windows::Form). You can avoid this error by specifying the namepace scope 'using namespace System::Windows::Form;'
Since you are new, please take some time and understand C++/CLI before creating this project. Regarding your previous question, there is a nice article in CP that discusses instantiating CLI classes: http://www.codeproject.com/Articles/17787/C-CLI-in-Action-Instantiating-CLI-classes

I strongly suggest that you go through this (as well as other introductory articles) and samples before creating your project. Good Luck!
prathikasaravanan 26-Oct-12 10:52am    
Hi Manoranjan,

Which is the best way i.e., win32 application runs the clr or reverse.
invoke managed code from Unmanaged code c++
invoke unmanaged code c++ from managed code

send us the example for adding native dll to managed code for UI( open the form with component).

Thank you,
K.Prathika

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900