MFC VC6 error for newly added command buttons in an existing project


I am working with a VC6 MFC project. I tried to add a command button in the existing project. When I double click on the newly added button to fire click event I am getting the below error "cannot add new member".

When i tried this with an existing command buttons in the project, it maps to the corresponding function correctly.

I tried adding the message mapping (manually) for the newly added function. But it doesn't gets called, when the event is fired.

When I tried to add class wizard for the dialog, even though the project contains all the files, VC6 can't able to find the project files and existing classes and hence it throws errors.

I tried the steps mentioned in the below links, but it doesn't work.

How to recover from MFC error "Cannot add new member"?

Kindly suggest me solution on how to add a command button to an existing project and also how to link the function call, corresponding to the added command button.

Thank you.

Found the solution: resource .h contains some default values


The next control which we place in the form should the _APS_NEXT_CONTROL_VALUE defined in resource.h.