1

I'm using VS 2019, working in C++. I created a property page with a few combo boxes and edit controls. For reasons I don't understand, the dialog editor decided one of the "custom" member variables in the class was attached to one of the Edit controls. What I mean is, when I run the Class Wizard and go to the "Member Vaiables" tab, it shows what should be a Custom variable as being attached to one of the Edit Controls. When I highlight it and press "Delete Variable", it does nothing. Here's what I've tried:

  • Removed the variable and confirm the class wizard no longer shows it. Put it back and is connects it to the Edit control again.
  • Changed the type of the variable. No effect.
  • Changed the name of the variable. No effect.
  • In the Class Wizard I tried adding the variable through the "Add Custom" dialog. It tells me the variable already exists.
  • Deleted and recreated the Edit Control. With a different ID. The wizard then shows the member variable as "custom". However, when I change the ID back to the original ID, it automagically links it up with the Edit Control again, so I really haven't solved the problem.

I don't know if this is related, but when I press "Delete Variable" I always get an error pop-up that says, "Index and length must refer to a location within the string." But I get this no matter what variable I delete and in the other cases it still deletes the variable.

Has anyone else seen this? Is there a way I can manually unlink remove this association?

Gregg H
  • 167
  • 1
  • 10
  • 2
    With the class wizard broken for two decades now, I haven't kept up with what it does. At the code level the association between class members and UI controls is done from within the `DoDialogExchange` implementation through one of the `DDX_` routines (see [TN026: DDX and DDV Routines](https://learn.microsoft.com/en-us/cpp/mfc/tn026-ddx-and-ddv-routines) for reference). I don't know whether that's the only data the class wizard uses to determine associations. – IInspectable Dec 02 '21 at 20:41
  • 1
    It looks like a bug in VS Class Wizard. I could easily reproduce it. The only thing to do I think is just go into the code and delete all references manually. – tromgy Dec 02 '21 at 21:19
  • You could report this issue to the [Developer Community](https://developercommunity.visualstudio.com/report?space=62&entry=problem). – Minxin Yu - MSFT Dec 03 '21 at 02:27
  • @MinxinYu-MSFT the class wizard has become virtually unusable many years ago, I believe the last one that worked properly was in Visual Studio 6.0. So I'm not sur MS will ever fix it. – Jabberwocky Dec 03 '21 at 08:51
  • Here is my prediction: A potential defect report will eventually have a bot leave the following reply: *"I detected that this issue hasn’t received a lot of activity, votes, or comments \[...\], it’s my experience that this issue is unlikely to get fixed."* Microsoft doesn't care about its native developer platform anymore. The amount of neglect is staggering. – IInspectable Dec 03 '21 at 10:28
  • I was surprised — and shocked — that MFC originating from 1992 is still being maintained. The current version is MFC 14.31.30818 released with Microsoft Visual C++ 2022 (17.1.0). I recommend trying out the current version (if you are able to), and see if the bug is still there. If the bug is still there, file a bug report. MFC is provided with [*full source code*](https://learn.microsoft.com/en-us/cpp/mfc/using-the-mfc-source-files?view=msvc-170), so alternatively you can fix the bug yourself. – Eljay Dec 03 '21 at 12:00
  • @tromgy - I'm not sure what you mean by delete all references manually. What references should I be looking for in the code? – Gregg H Dec 03 '21 at 19:57
  • I meant to delete any (additional) references that ClassWizard (possibly) created -- check if it created any DDX_ bindings for this variable and delete them. – tromgy Dec 04 '21 at 02:15

0 Answers0