Click here to Skip to main content
15,903,362 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
can any one give me the solution in vc++ button click event
I tried the following code but I received the error that
error C2065: 'IDD_DIALOG1' : undeclared identifier

my code is following

C#
#pragma once


// K11 dialog

class K11 : public CDialog
{
    DECLARE_DYNAMIC(K11)

public:
    K11(CWnd* pParent = NULL);   // standard constructor
    virtual ~K11();

// Dialog Data
    enum { IDD = IDD_DIALOG1 };

protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

    DECLARE_MESSAGE_MAP()
};




provide the solution quickl
Posted
Comments
Nelek 25-May-13 6:11am    
That can be triggered by Copy & Paste and trying to get a ready-to-go solution. I suggest you to start with a tutorial and do the work on your own.

1 solution

IDD_DIALOG1 is the name of the dialog resource. You need to make sure you have #include "resource.h" listed where you include your dialog header file.

In your case, you might have named the files K11.h and K11.cpp, so in your K11.cpp, you should have something like this at the top of the file:
C++
#include "resource.h"
#include "K11.h"


At times, you will get the error even if you have the includes correct. This happens because the IDE fails to notice that you have added a new resource. In that case a Rebuild All will normally solve the problem.


<Edit>
Note, that this only addresses the compilation error you are getting. Handling a button click is pretty simple, but there is nothing in the code you have posted related to that.
</Edit>


Soren Madsen
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900