Solved

Error Dialog

Posted on 1998-06-04
3
213 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
Comment Utility
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
Comment Utility
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
Comment Utility

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Replacement selected text 2 47
Hibernate methods 2 58
modThree challenge 4 64
Thin secure Windows 10 5 46
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…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

10 Experts available now in Live!

Get 1:1 Help Now