How do I add existing visual Item to a project

  • Thread starter Thread starter tony
  • Start date Start date
T

tony

Hello!!

Normally I use C# but we have a project that is creating a window control
library DLL that is done in C++.NET and that is here I have some problems
that I want to solve.

To be able to understand my question fully, I do the following.

1. Create a project that is a WindowControlLibrary called Test in C++.NET
in this project we have several files but the following are intresting for
me.
Under Source Files we have a file called TestControl.cpp
Under Header Files we have a file called TestControl.h and if you expand
this file you can see
TestControl.resX.

2.Open View Designer for TestControl.h and add for example a button.
3. Everything works as it should so far.
4. Now delete file TestControl.cpp and TestControl.h from the project Test.
When file TestControl.h was deleted, file TestControl.resX was also deleted
because it was connected to TestControl.h
5. The files still exist in folder Test but does not exist in project Test.
6 Now assume that you want to add these files(TestControl.cpp, TestControl.h
and TestControl.resX) back into project Test again.
7 I have tried different variation for Add Existing Item for my three files
to project Test but all my attempts failed in the way that I can never open
View Designor.
8 So how do I do if I want to add an existing visual control like the
TestControl.
9 It works perfectly to add new Item which I do in this way click on Source
File and select add New Item and choose for example User Control.

//Tony
 
Normally I use C# but we have a project that is creating a window control
library DLL that is done in C++.NET and that is here I have some problems
that I want to solve.

To be able to understand my question fully, I do the following.

1. Create a project that is a WindowControlLibrary called Test in C++.NET
in this project we have several files but the following are intresting for
me.
Under Source Files we have a file called TestControl.cpp
Under Header Files we have a file called TestControl.h and if you expand
this file you can see
TestControl.resX.

2.Open View Designer for TestControl.h and add for example a button.
3. Everything works as it should so far.
4. Now delete file TestControl.cpp and TestControl.h from the project
Test.
When file TestControl.h was deleted, file TestControl.resX was also
deleted
because it was connected to TestControl.h
5. The files still exist in folder Test but does not exist in project
Test.
6 Now assume that you want to add these files(TestControl.cpp,
TestControl.h
and TestControl.resX) back into project Test again.
7 I have tried different variation for Add Existing Item for my three
files
to project Test but all my attempts failed in the way that I can never
open
View Designor.
8 So how do I do if I want to add an existing visual control like the
TestControl.
9 It works perfectly to add new Item which I do in this way click on
Source
File and select add New Item and choose for example User Control.

Hi,

I could not find it either, but my curiosity got the best of me.
I found a first solution by hacking the vcproj file with notepad, but that
is not the best solution of course.

After some more fiddling I finally found the good way to do this:
1) add the files to your project again.
2) make the properties window visible (view ->other windows ->property
window)
3) select the header file
4) change the file type to C++ form

That changes it back to the state where you can edit it with the designer.

--

Kind regards,
Bruno van Dooren
(e-mail address removed)
Remove only "_nos_pam"
 
Back
Top