question

Dudu-0391 avatar image
0 Votes"
Dudu-0391 asked Viorel-1 answered

Error: Did not find a dialog class with the specified ID

I add dialog class for dialog resource by right click resource and select Add Class in designer.

In header file and cpp file of the dialog class, I add:

namespace N01 {
namespace N02 {
}
}

around codes in those files

When I add a edit box control on dialog resource in design view and right click on the control then select Add Variable, I get error of: Did not find a dialog class with the specified ID

Thanks.

c++
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Viorel-1 avatar image
0 Votes"
Viorel-1 answered

It is probably possible to find some workarounds; for example, you can replace the namespace declarations with a macro (inside the .h file only):

 #define NS(n) namespace n {
    
    
 NS(N01) NS(N02)
    
    // Dialog class
    Class MyDialog
    {
       . . .
    }
 } }

Then “Add Variable…” should work. However, MFC was not designed for such scenarios and some of special features, introduced by existing DECLARE_DYNAMIC macros, probably will not always work.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.