Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ ATL
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 25-Oct-12 7:04am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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[^]
  Permalink  
Comments
prathikasaravanan at 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 at 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 at 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 at 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 at 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)

  Print Answers RSS
0 OriginalGriff 562
1 Sergey Alexandrovich Kryukov 484
2 Maciej Los 325
3 DamithSL 233
4 Mathew Soji 195
0 OriginalGriff 7,168
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,461
3 Manas Bhardwaj 4,876
4 Maciej Los 4,450


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 26 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100