views:

29

answers:

2

I created a dialog and then created a class linked to it using the wizard. Somehow VC++ has forgotten this and now wants me to create a class whenever I double-click on a control in the editor to create a handler. Are these mappings stored in a file I can edit, or does VC++ try to deduce this and I'm stuck with it?

A: 

In the header file for your dialog you should have a line like:

enum { IDD = IDD_ABOUTBOX_DLGTEST };

This specifies the resource ID for your dialog. Have you changed the ID for your dialog in the dialog Properties? Either change it back, or change the enum in the header file.

Note, any change might not get picked up by the wizard until you've done a re-compile.

njplumridge
I changed it, but made sure the resource.h and IDD match
John
Do the IDD_xxx identifiers in resource.h, <yourdialog>.h and the property sheet for the dialog match? I tried changing resource.h and on the Property sheet for the dialog that gave me the original IDD surrounded by double quotes, and it wanted to add a new class.
njplumridge
A: 

As well as njplumridge's answer, also check that you have the right #include "projectname.h" file in all your classes.

You can sometimes have problems with MFC tools mapping if you change the name of the project but leave the projectname.h file unchanged.

But there's no extra mapping file to worry about, it's all inferred from the source code.

Will Dean