大 大狗熊 Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-22 #1 如题,如何获取当前窗体的屏幕坐标,和距离屏幕上下左右的尺寸<br>研究了半天,没研究出来,主要是因为分辨率不同,屏幕大小不同,得到的尺寸不同,所以不能用绝对坐标,请指点
L lovecathy Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-22 #2 ScreenToClient<br>ClientToScreen
T t1122 Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-22 #3 procedure TForm1.Button6Click(Sender: TObject);<br>var<br> Rect: TRect;<br>begin<br> showmessage(inttostr(whandle));<br> GetWindowRect(whandle,Rect);//获得窗口位置<br> showmessage('top:'+inttostr(rect.Top)+'left:'+inttostr(rect.Left)+'right:'+inttostr(rect.Right));<br>// mouse_event(<br>end;
procedure TForm1.Button6Click(Sender: TObject);<br>var<br> Rect: TRect;<br>begin<br> showmessage(inttostr(whandle));<br> GetWindowRect(whandle,Rect);//获得窗口位置<br> showmessage('top:'+inttostr(rect.Top)+'left:'+inttostr(rect.Left)+'right:'+inttostr(rect.Right));<br>// mouse_event(<br>end;
大 大狗熊 Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-22 #4 ..不好意思,没说清楚,当前窗体是指的用一个程序去获得其他当前窗体,不是编程实现自身获取
W wynney Unregistered / Unconfirmed GUEST, unregistred user! 2006-12-07 #5 加个findwindow得到你要捕获的目标的句柄<br>再配合t1122的代码可以完成
W wynney Unregistered / Unconfirmed GUEST, unregistred user! 2006-12-31 #6 var<br>hWindow:THandle<br>hRect:TRect;<br>begin<br>hWindow:=FindWindow(nil,'xxx'); //窗体名<br>{上面的句柄还可以通过进程名转换得来}<br>GetWindowRect(hWindow,Rect);<br>EditRect.text:='Left:' + IntToStr(hRect.Left) + ' Top:' + IntToStr(hRect.Top)<br> + ' Right:' + IntToStr(hRect.Right) + ' Bottom:' + IntToStr(hRect.Bottom);<br>end;
var<br>hWindow:THandle<br>hRect:TRect;<br>begin<br>hWindow:=FindWindow(nil,'xxx'); //窗体名<br>{上面的句柄还可以通过进程名转换得来}<br>GetWindowRect(hWindow,Rect);<br>EditRect.text:='Left:' + IntToStr(hRect.Left) + ' Top:' + IntToStr(hRect.Top)<br> + ' Right:' + IntToStr(hRect.Right) + ' Bottom:' + IntToStr(hRect.Bottom);<br>end;
R renaihaore Unregistered / Unconfirmed GUEST, unregistred user! 2006-12-31 #7 你可以用 QQ自带的那个 载图工具 那上面可以 载取到 坐标<br><br>希望给分分 嘿嘿