Link to home
Start Free TrialLog in
Avatar of nhcuong
nhcuong

asked on

Error Dialog

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
ASKER CERTIFIED SOLUTION
Avatar of SamratAshok
SamratAshok

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nhcuong
nhcuong

ASKER

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 !
 

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 ;-)