在Project->Settings->Link中去掉Generate debug info和Link incrementlly选项,再选择Category组合框的Customize,去掉Use program database选项,最后在Project Options中加入"/release",一切OK!
#include <imagehlp.h>
#pragma comment(lib, "imagehlp.lib")
bool CheckExeSum()
{
char Fn[512];
DWORD HeadChksum = 1, Chksum = 0;
GetModuleFileName(GetModuleHandle(NULL), Fn, 512);
if(MapFileAndCheckSum(Fn, &HeadChksum, &Chksum) != CHECKSUM_SUCCESS)
{
return false;
}
else if(HeadChksum != Chksum)
{
return false;
}
return true;
}
文章出处:http://www.diybl.com/course/3_program/vc/vc_js/2008618/126148.html