Solved

Error Dialog

Posted on 1998-06-04
3
214 Views
Last Modified: 2013-11-19
I have to creat a program: A dialog have a button (Show). Press Show,
then anther dialog is displayed.
I created the first dialog. Then Insert ->Resource->Dialog->New to
create the second dialog (IDD_SHOWPEN).
After that Insert->New Class and declare all: Class type (MFC), Name
(CShowPen), Base class (CDialog), Dialog ID (IDD_SHOWPEN).
I use ClassWizard to write code for button Show
CTestDoc::OnShowPen()
{
    CShowPen    dlg;
    dlg.DoModal();
}
However I received an error: "CShowPen unclared indentifier"  
Where's wrong in my program. Please tell me !
Thanks
0
Comment
Question by:nhcuong
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
SamratAshok earned 20 total points
ID: 1315993
You probably forgot to include the .h (containing CShowPen definition )
in the .cpp (containing CTestDoc).

WARNING :
As I was writing this, I realize that you mentioned two dialog boxes in your description
and the class names shown there seem to be following a different naming convention.
In general MFC Parlance, people name CDocument derived classes ending in Doc.

In general, dialog boxes do not have docs associated with them and they can not
handle the button clicks on dialogs boxes.


0
 

Author Comment

by:nhcuong
ID: 1315994
You're right,  I forgot #include ... Now everything is OK.
But I don't understand your warning:
" In general MFC Parlance, people name CDocument derived classes
  ending in Doc. In general, dialog boxes do not have docs associated
  with them and they can not handle the button clicks on dialogs boxes. "
I've used Wizard in the same steps of Scribble Tutorial of MS.
Could you explain me more clearly !
 
0
 
LVL 2

Expert Comment

by:SamratAshok
ID: 1315995

What I meant to say was this!

As a part of MFC naming conventions (most of them de-facto)

a class derived from CDocument gets a suffix as Doc
a class derived from CView gets suffix as View or Vw
a class derived from CDialog gets suffix as Dlg
and so on ...


In your description, you were mentioning two dialog boxes
but in the code-snippet,

You showed CTestDoc and CShowPen. My comment was because of the first class name. I just wanted to warn that you might be editing the wrong file all this time.

Hey ! If it worked, ignore the warning ;-)



0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 106
Folder Comparison 12 53
notReplace  challenge 53 116
wordmultiple challenge 12 121
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now