Solved

Error Dialog

Posted on 1998-06-04
3
215 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

803 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