Click here to Skip to main content
13,046,679 members (66,717 online)
Rate this:
Please Sign up or sign in to 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,
Posted 25-Oct-12 6:04am

1 solution

Rate this: bad
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[^]
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,
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:
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,
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:

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,

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 26 Oct 2012
Copyright © CodeProject, 1999-2017
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