Click to See Complete Forum and Search --> : adding Dialog to c++.Net project
BeePo
February 2nd, 2005, 03:44 PM
Hi,
Can I add resources (dialog) to exiting c++.net project?
I'm very very new to c++.Net. Here the way how I created the project.
1) New project
2) Visual C++ Projects
3) Clicked on .Net folder
4) Empty Project (.Net)
then I add the dialog resource
1) Right click on Project
2) Add Resource
3) Choose Dialog, the Click on New
4) I double click on the dialog, then MFC Class Wizard window come out.
5) Then I insert the Class name for that dialog, chose Dialog for based classes.
6) I click on Finished
But nothing has created... no class or any cpp or .h file get created.
Why is it? Is it because the dialog is only for regular MFC project and not for .Net project?
Thanks
digwizf18
February 8th, 2005, 12:04 PM
Creating the resource does not automatically create the class for it. This is by design. You have to right click on the dialog and select add class and this will bring up the class wizard. Same for all of the items. As you create the dialogue, you will drag things from the toolbox onto the dialogue and organize things. Then if you want to have class variables associated with the buttons and controls, you'll have to right click on them and select add variable. Play around with the wizard some and you'll see that if you right click on the dialogue or buttons and select properties that a properties view will come up and allow you to configure the dialogue and buttons; you'll be able to add functions to handle windows messages or override base class functions. Try fiddling around with those features and I think you'll find the wizard in visual studio .Net to be quite intuitive. The same is true of menus. You have to setup the properties and use the wizard to add function handlers for menu items as well.
Hope that helps,
Shawn
BeePo
February 11th, 2005, 12:10 PM
Yes, I right click on dialog, and add the class. it does allow me to add the class now. but when i run the program, i got following errors.
Is it because my application is c++.Net, form based application?
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(13): error C2065: 'IDD_ASSOCFILES' : undeclared identifier
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.cpp(40): error C2653: 'MessageBoxA' : is not a class or namespace name
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.cpp(40): error C3861: 'Show': identifier not found, even with argument-dependent lookup
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(13): error C2065: 'IDD_ASSOCFILES' : undeclared identifier
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(5): error C2504: 'CDialog' : base class undefined
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(8): error C2143: syntax error : missing ';' before 'public'
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(8): warning C4183: 'DECLARE_DYNAMIC': missing return type; assumed to be a member function returning 'int'
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(9): error C2143: syntax error : missing ')' before '*'
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(9): error C2143: syntax error : missing ';' before '*'
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(9): error C2460: 'CAssocFiles::CWnd' : uses 'CAssocFiles', which is being defined
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(4) : see declaration of 'CAssocFiles'
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(9): error C2065: 'NULL' : undeclared identifier
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(9): error C2059: syntax error : ')'
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(9): error C2864: 'pParent' : only const static integral data members can be initialized inside a class or struct
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(9): error C2501: 'CAssocFiles::pParent' : missing storage-class or type specifiers
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(13): error C2065: 'IDD_ASSOCFILES' : undeclared identifier
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(16): error C2061: syntax error : identifier 'CDataExchange'
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(19): error C2143: syntax error : missing ';' before 'public'
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(19): warning C4183: 'DECLARE_MESSAGE_MAP': missing return type; assumed to be a member function returning 'int'
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(20): error C2144: syntax error : 'void' should be preceded by ';'
c:\DotNetProgs\Rascoe\Rascoe\AssocFiles.h(20): error C2501: 'CAssocFiles::afx_msg' : missing storage-class or type specifiers
BeePo
February 11th, 2005, 12:31 PM
The problem above was fixed by adding
#include ".\resoruce.h"
But I can't call
myDlg.DoModal().
I got assert error.
Can anyone tell me how to add and use the dialog (CDialog) in C++.Net application as I am used to use in MFC applications.
Thank you.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.