Thread: A question about Dialog

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    2

    Arrow A question about Dialog

    Hi, everyone. I'm a newbie in C++. I have a program that create a simple dialog.

    Code:
    // Filename: test31.CPP
    
    #include <afxwin.h>
    #include "Resource.h"
    
    
    class DialogApp : public CWinApp
    {
    public:
    	BOOL InitInstance();	
    };
    
    class CExoDialog : public CDialog
    {
    public:
    	enum { IDD = IDD_DIALOG1 };
    
    	CExoDialog();
    };
    
    CExoDialog::CExoDialog()
    	: CDialog(CExoDialog::IDD, NULL) /// May I replace IDD by IDD_DIALOG1?
    }
    
    
    BOOL DialogApp::InitInstance()
    {	
    	CExoDialog Dlg;
    	m_pMainWnd = &Dlg;
    	Dlg.DoModal();
    
    	return TRUE;
    };
    
    DialogApp theApp;
    
    //End of test31.CPP
    -------------
    Code:
    //Filename: resource.h
    //{{NO_DEPENDENCIES}}
    // Microsoft Developer Studio generated include file.
    // Used by Script1.rc
    //
    #define IDD_DIALOG1                     101
    #define IDC_PROGRESS1                   1000
    #define IDC_IPADDRESS1                  1001
    #define IDC_EDIT1                       1005
    #define IDC_ANIMATE1                    1006
    #define IDC_SLIDER1                     1007
    #define IDC_BUTTON1                     1008
    #define IDC_CHECK1                      1009
    
    // Next default values for new objects
    // 
    #ifdef APSTUDIO_INVOKED
    #ifndef APSTUDIO_READONLY_SYMBOLS
    #define _APS_NEXT_RESOURCE_VALUE        102
    #define _APS_NEXT_COMMAND_VALUE         40001
    #define _APS_NEXT_CONTROL_VALUE         1010
    #define _APS_NEXT_SYMED_VALUE           101
    #endif
    #endif
    -------------
    When I replace IDD with IDD_DIALOG1, I get some errors:error C2589: 'constant' : illegal token on right side of '::'. Why?
    Last edited by nnvkct; 09-15-2008 at 05:08 AM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    You might want to describe what errors you got.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another exercise question
    By luigi40 in forum C# Programming
    Replies: 3
    Last Post: 11-28-2005, 03:52 PM
  2. Document Class and Dialog Windows :: MFC
    By kuphryn in forum Windows Programming
    Replies: 3
    Last Post: 12-01-2002, 12:27 AM
  3. edit control in dialog box problems
    By Bajanine in forum Windows Programming
    Replies: 11
    Last Post: 11-11-2002, 06:55 PM
  4. MFC Dialog App Screen Refresh Question
    By Scotth10 in forum Windows Programming
    Replies: 2
    Last Post: 10-18-2002, 02:07 PM
  5. Dialog Box & Property Sheet :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 08-01-2002, 01:33 PM