简体   繁体   English

从 MFC C++ 6.0 应用程序迁移到 VS 2005

[英]migrating from MFC C++ 6.0 application to VS 2005

I have a big application developed in MFC C++ 6.0 and I want to migrate it to VS2005 and then, to VS2012.我有一个用 MFC C++ 6.0 开发的大型应用程序,我想将它迁移到 VS2005,然后再迁移到 VS2012。 I'm looking for solve as much errors as I can, however I run into this situation:我正在寻找解决尽可能多的错误,但是我遇到了这种情况:

I had a MFC C++ method: BOOL CPaginaModelo::OnRetirar_ItemLista() wich returned a boolean value.我有一个 MFC C++ 方法: BOOL CPaginaModelo::OnRetirar_ItemLista() 返回一个布尔值。 So in many cpp files I use code like:所以在许多 cpp 文件中,我使用如下代码:

if (CPaginaModelo::OnRetirar_ItemLista())
{
    <code>
}

For migration reasons, I have to change such method from BOOL to void, so the code should looks like:出于迁移原因,我必须将此类方法从 BOOL 更改为 void,因此代码应如下所示:

CPaginaModelo::OnRetirar_ItemLista();
<code>

Since there are a lot of parts of the project files where this is used, is there any way by using search and replace with regular expressions in VS2005 to replace first expression to look like second expression?由于项目文件的很多部分都使用了它,有没有办法在VS2005中使用搜索和替换正则表达式来将第一个表达式替换为第二个表达式?

Thanks for your help谢谢你的帮助

Find and replace operation is not dependent on visual studio version.查找和替换操作不依赖于 Visual Studio 版本。 If you want use higher version of VS for this purpose then you just need to open particular VS and in find window replace window, replace parameter of "Look In" from entire solution to folder of your solution.如果您想为此使用更高版本的 VS,那么您只需要打开特定的 VS 并在查找窗口替换窗口中,将“Look In”的参数从整个解决方案替换为您的解决方案文件夹。 This will allow you apply find and replace operation on certain folder.这将允许您对某些文件夹应用查找和替换操作。

To solved your issue, Multiline Search and Replace will help to complete replacement of your code with specific.为了解决您的问题, 多行搜索和替换将帮助您完成特定代码的替换。

You could find and replace text in the Visual Studio editor by using Find and Replace ( Ctrl + F or Ctrl + H ) or Find/Replace in Files ( Ctrl + Shift + F or Ctrl + Shift + H ).您可以使用查找和替换( Ctrl + FCtrl + H )或在文件中查找/替换( Ctrl + Shift + FCtrl + Shift + H )在 Visual Studio 编辑器中查找和替换文本。 For more details, I suggest you could refer to the link: https://docs.microsoft.com/en-us/visualstudio/ide/finding-and-replacing-text?view=vs-2019有关更多详细信息,我建议您可以参考以下链接: https : //docs.microsoft.com/en-us/visualstudio/ide/finding-and-replacing-text?view=vs-2019

You could also try to use .NET regular expressions to find and replace text in visual studio.您也可以尝试使用.NET 正则表达式在 Visual Studio 中查找和替换文本。 For more details, I suggest you could refer to the link: https://docs.microsoft.com/en-us/visualstudio/ide/using-regular-expressions-in-visual-studio?view=vs-2019有关更多详细信息,我建议您可以参考以下链接: https : //docs.microsoft.com/en-us/visualstudio/ide/using-regular-expressions-in-visual-studio?view=vs-2019

As far as I'm concerned, Replacement couldn't make a symbol disappear, so { } may need to be removed manually.就我而言, Replacement 无法使符号消失,因此{ }可能需要手动删除。

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

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