Solved

Error Dialog

Posted on 1998-06-04
3
217 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Replacement selected text 2 69
Smart Camera scanning and reading information 3 126
has22 challenge 11 110
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 1,669
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
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…

734 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