WallBreaker2 / op

Windows消息模拟,gdi,dx,opengl截图,找图,找字(OCR)
MIT License
439 stars 165 forks source link

FindStr在BindWindow为normal正常模式时的坐标问题 #20

Closed jonathanpeng closed 4 years ago

jonathanpeng commented 4 years ago

FindStr在BindWindow为normal正常模式时找到的坐标和MoveTo方法的坐标不匹配,需要去掉windows窗口边框的宽度和标题栏的高度 我的做法是这样的: //设置窗口在屏幕的位置为0,0 MoveWindow(hwndOpCom, 0, 0); //调用GetClientRect获取目标窗口在屏幕的位置,我的系统里是边框宽度5,标题栏高度28 GetClientRect(hwndOpCom, out cx1, out cy1, out cx2, out cy2); //调用findstr方法获取字符位置 opCom.FindStr(0, 0, sw, sh, tznpc, "ffffff-000000", 1.0, out ox, out oy); //x坐标减去边框宽度,y坐标减去标题栏高度 x = Convert.ToInt32(ox) - borWidth; y = Convert.ToInt32(oy) - borHeight; //此时移动鼠标才是正确的文本所在坐标点 opCom.MoveTo(x, y);

WallBreaker2 commented 4 years ago

已修复