2

I'm new to Visual C++/MFC.

Trying to create simple dialog with few controls. I want to access 'Edit Control's value in my code. For that, when I try to add variable name for 'Edit control'(or any other control) using "Add Control Variable" wizard, it gives error.

Am i missing something?

enter image description here

enter image description here

I have following packages installed already: enter image description here

C.P.
  • 1,182
  • 3
  • 13
  • 32
  • Which version of visual studio you are using and type of project selected? – Santosh Dhanawade Jul 16 '19 at 05:03
  • I am using "Microsoft Visual Studio Community 2019", Version 16.1.16. Although, I want to create MFC application, this option doesn't show up in "Create New Project" wizard. So, I chose 'Empty Project' and then from 'Properties' changed "Use of MFC" option to "Use MFC in Shared DLL". Also changed 'Subsystem' to 'Windows' – C.P. Jul 16 '19 at 05:09
  • I don't think this proper way to create MFC application. I this MFC is not installed on your machine. If it would then you will get MFC project creation option in new project. Go through https://stackoverflow.com/questions/43074045/mfc-development-in-vs2017 – Santosh Dhanawade Jul 16 '19 at 05:54
  • Thank you. But I think I already have MFC related packages installed. Updated question with screenshot of installation details. – C.P. Jul 16 '19 at 06:26

2 Answers2

3

Please check whether you have DoDataExchange function added to your dialog class. Once I added this function, I am able to add variable using wizard.

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
  • Fantastic! I had just created a `CMFCPropertyPage` class and it boilerplate code did not link it in to this method. That must be a bug surely?! I had to add it. Mint ...! – Andrew Truckle May 15 '20 at 18:33
1

This seems to be "MFC class wizard problem". Microsoft tracked and solved this in following forum: https://developercommunity.visualstudio.com/content/problem/208727/mfc-class-wizard-cant-add-control-member-variables.html

The latest version of visual studio should solve this.

Santosh Dhanawade
  • 1,756
  • 14
  • 29
  • I have been using the wizards for sometime. But the whole system is still glitchy. It seems they develop with laboratory test projects and not real complex projects developed over years. They should provide proper debug tools to fix these issues once and for all. Without debugging why classwizard fails it is hard ... – Andrew Truckle Jul 16 '19 at 15:30