不同版本的VS打开同一个项目,添加新资源,MFC在使用picture console控件之后往往会弹出这个错误:error RC2108: expected numerical dialog constant。此时,双击这个错误,会跳到提示错误的那一行,在那一行中的一串地址前插入:"Static", SS_BITMAP,
以上是网上找到的解决办法。但是发现要手动加的地方太多了,一个一个加太麻烦了,然后想到用python写个脚本来解决。代码如下:
#*- coding:utf-8 -*
#目的:解决vs2013版本,在以前的项目增加资源后编译会出现error RC2108: expected numerical dialog constant的问题。在CONTROL行,增加"Static",SS_BITMAP
import os
import sys
import re
import time
#*.rc文件的绝对路径,比如我的是test.rc
filepath=r"E:\test\projectCode\test.rc"
def bakFile():
"""备份文件"""
os.chdir(os.path.dirname(filepath))
timestamp=time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime())
sourceFile=os.path.basename(filepath)
backupFile=os.path.basename(fil