提示:本地函数定义是非法的,有谁可以帮我看看吗?。

jwqih1 2010-11-09 10:41:02
bool FindPic(int x,int y,int xx,int yy, CString FileName, double s, int &rex,int &rey)
{
CBitmap bmp;
BITMAP bm;
HBITMAP hBmp;
CDC bmpDC;
hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),FileName,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
bmp.DeleteObject();
bmp.Attach( hBmp );
bmp.GetObject(sizeof(BITMAP),&bm);
bmpDC.CreateCompatibleDC(NULL);
bmpDC.SelectObject(&bmp); //图片DC

HDC hScreenDC = ::GetDC(NULL); //屏幕DC
bool found = false;//是否匹配到

bool next = false;//是否找下一个点

int width = bm.bmWidth;
int height = bm.bmHeight;
int limit = (double)(width * height) * (1-s);
int count = 0;

for (int i = x; i < (xx - width) && !found ; i++)
{
for (int j = y ; j < (yy - height) && !found ; j++)
{
next = false;
count = 0;
for (int a = 0;a<width && !next;a++)
{
for (int b = 0;b<height &&!next;b++)
{
if(GetPixel(hScreenDC,i+a,j+b) != bmpDC.GetPixel(a, b))
{
//next = true;//找屏幕中下一个点
count ++;
}
if (count > limit)
{
next = true;
}
}
}
if (!next)//找到点
{
found = true;
rex = i;
rey = j;
return true;
break;
}
}
}
return false;
}
...全文
244 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
一条晚起的虫 2010-11-09
  • 打赏
  • 举报
回复
// 光这段代码看不出。
// 错误定位到哪一行?
真相重于对错 2010-11-09
  • 打赏
  • 举报
回复
FindPic上下的代码?

jwqih1 2010-11-09
  • 打赏
  • 举报
回复
错误C2601:'FindPic':本地函数定义是非法的

19,473

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧