Z zhengyun Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-09 #1 我把屏幕取词的功能实现了,但不知道在那里可以限制取的词的范围!还有就是怎么样让这个屏幕取词的窗体永远位于其他窗体的前面呢?请诸位高手帮忙!
C Corn3 Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-09 #5 “限制取词范围”什么意思? 第二个问题,可以设这个窗体的FormStyle = fsStayOnTop
Z zhengyun Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-09 #6 我的意思是:我把屏幕取出的词限制两个字,也就是就让它取两个字;如果遇到逗号或什么标点符号都不可以显示标点符号!我就是不知道在那个地方写这些代码,希望高手帮助我!
Z zhengyun Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-10 #9 我的确切意思是:鼠标获得的是一行文字;我想得到的是一个单词;不知道怎么做了!
Z zhengyun Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-10 #10 {计算显示文字的屏幕坐标} poText.x := poDC.x + poOri.x; poText.y := poDC.y + poOri.y; {获取当前鼠标的坐标} GetCursorPos(poMouse); {如果对齐属性是居中} if (GetTextAlign(theDC) and TA_UPDATECP) <> 0 then begin GetCurrentPositionEx(theDC, @poOri); poText.x := poText.x + poOri.x; poText.y := poText.y + poOri.y; end; {显示文字的长和宽} GetTextExtentPoint(theDC, Str, Count, Size); {鼠标是否在文本的范围内} if (poMouse.x >= poText.x) and (poMouse.x <= poText.x + Size.cx) and (poMouse.y >= poText.y) and (poMouse.y <= poText.y + Size.cy) then begin {最多取MaxStringLen个字节} dwBytes := min(Count, MaxStringLen); {拷贝字符串} CopyMemory(@(pShMem^.Text), Str, dwBytes); {以空字符结束} pShMem^.Text[dwBytes] := Chr(0); {发送WM_MOUSEPT成功取词的消息给主程序} postMessage(pShMem^.hProcWnd, WM_MOUSEPT, fTextOutA, 2); {如果输出的不是Tab键,而且是精确匹配的} if (string(pShMem^.Text)<>#3)and(not faint) then pShMem^.bCanSpyNow := False;{取词结束} end; end;
{计算显示文字的屏幕坐标} poText.x := poDC.x + poOri.x; poText.y := poDC.y + poOri.y; {获取当前鼠标的坐标} GetCursorPos(poMouse); {如果对齐属性是居中} if (GetTextAlign(theDC) and TA_UPDATECP) <> 0 then begin GetCurrentPositionEx(theDC, @poOri); poText.x := poText.x + poOri.x; poText.y := poText.y + poOri.y; end; {显示文字的长和宽} GetTextExtentPoint(theDC, Str, Count, Size); {鼠标是否在文本的范围内} if (poMouse.x >= poText.x) and (poMouse.x <= poText.x + Size.cx) and (poMouse.y >= poText.y) and (poMouse.y <= poText.y + Size.cy) then begin {最多取MaxStringLen个字节} dwBytes := min(Count, MaxStringLen); {拷贝字符串} CopyMemory(@(pShMem^.Text), Str, dwBytes); {以空字符结束} pShMem^.Text[dwBytes] := Chr(0); {发送WM_MOUSEPT成功取词的消息给主程序} postMessage(pShMem^.hProcWnd, WM_MOUSEPT, fTextOutA, 2); {如果输出的不是Tab键,而且是精确匹配的} if (string(pShMem^.Text)<>#3)and(not faint) then pShMem^.bCanSpyNow := False;{取词结束} end; end;
Z zhengyun Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-10 #11 这些代码需要进行改动!需要把矩形框改成是一个文字的窗体!