简体   繁体   English

新添加到现有项目中的命令按钮的VC6 MFC错误

[英]VC6 MFC error for newly added command buttons into an existing project

I am working with a VC6 MFC project. 我正在使用VC6 MFC项目。 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. 当我尝试为对话框添加类向导时,即使项目包含所有文件,VC6也无法找到项目文件和现有类,因此会引发错误。

I tried the steps mentioned in the below links, but it doesn't work. 我尝试了以下链接中提到的步骤,但不起作用。

How to recover from MFC error "Cannot add new member"? 如何从MFC错误“无法添加新成员”中恢复?

http://msdn.microsoft.com/en-us/library/aa295101(v=vs.60).aspx http://msdn.microsoft.com/zh-CN/library/aa295101(v=vs.60).aspx

http://social.msdn.microsoft.com/Forums/en-us/vclanguage/thread/1d4cb1f6-f471-46f9-abf3-fa9bb09d1e40 http://social.msdn.microsoft.com/Forums/zh-CN/vclanguage/thread/1d4cb1f6-f471-46f9-abf3-fa9bb09d1e40

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 找到了解决方案:resource .h包含一些默认值

#define _APS_NEXT_CONTROL_VALUE 1025 #定义_APS_NEXT_CONTROL_VALUE 1025

The next control which we place in the form should the _APS_NEXT_CONTROL_VALUE defined in resource.h. 我们在表单中放置的下一个控件应该是在resource.h中定义的_APS_NEXT_CONTROL_VALUE。

The version of MFC that ships with Visual C++ 6 (which is ancient by the way) does not support Command Buttons, which were not added until much later. 随Visual C ++ 6附带的MFC版本(顺便说一句很古老 )不支持命令按钮,直到不久以后才添加。 You can still use command buttons if you are careful (ie detect if the platform your app is running on supports command buttons) and by adding message handlers for the specific command button messages directly. 如果您谨慎(例如,检测应用程序运行的平台是否支持命令按钮)并直接为特定命令按钮消息添加消息处理程序,则仍可以使用命令按钮。

Long story short: get a new version of Visual C++. 长话短说:获得Visual C ++的新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM