Delphi 窗体函数GetWindowRect 取窗口矩形坐标
GetWindowRect,用于取窗口矩形坐标。返回值类型:布尔型(LongBool)。执行成功返回真(True),否则返回假(False);参数1类型:整数型(HWND),目标窗口的窗口句柄;参数2类型:坐标结构(RECT),目标窗口的坐标结构地址。在Windows SDK中的函数原型:
BOOL GetWindowRect(
HWND hWnd, // handle of window 参数1:目标窗口句柄
LPRECT lpRect // address of structure for window coordinates 参数2:窗口的坐标结构地址
);
RECT定义:
typedef struct _RECT { // rc
LONG left; //桌面窗口到目标窗口的左边距
LONG top; //桌面窗口到目标窗口的顶边距
LONG right; //桌面窗口到目标窗口的右边距
LONG bottom; //桌面窗口到目标窗口的底边距
} RECT;
例如:
var
R: TRect;
begin
GetWindowRect(Form1的句柄, R);
ShowMessageFmt('宽: %d, 高: %d, 横坐标: %d, 纵坐标: %d', [R.Right-R.Left,
R.Bottom-R.Top,R.Left,R.Top]);
end;
var
hwnd:HWND;
R:TRect;
begin
hwnd:=FindWindow('SciCalc','计算器');
GetWindowRect(hwnd,R);
lable1.Caption := IntToStr(R.Left)+','+ IntToStr(R.Top)+'/'+
IntToStr(R.Right)+ ','+ IntToStr(R.Bottom );
end;
Delphi 窗体函数GetWindowRect 取窗口矩形坐标的更多相关文章
- Delphi 窗体函数GetWindow
Delphi 窗体函数GetWindowGetWindow是计算机的函数,该函数返回与指定窗口有特定关系(如Z序或所有者)的窗口句柄,函数原型是HWND GetWindow(HWND hWnd,UIN ...
- 2018-11-26-win10-uwp-获取窗口的坐标和宽度高度
title author date CreateTime categories win10 uwp 获取窗口的坐标和宽度高度 lindexi 2018-11-26 15:4:0 +0800 2018- ...
- Delphi 窗体函数 ShowScrollBar 控制滚动条
API函数 函数来源:FUNCTION ulong ShowScrollBar(ulong hwnd,ulong wBar,ulong bShow) LIBRARY "user32.dll& ...
- delphi公共函数 UMyPubFuncFroc--版权所有 (C) 2008 勇者工作室
{*******************************************************} { } { Delphi公用函数单元 } { } { 版权所有 (C) 2008 勇 ...
- delphi公用函数
{*******************************************************} { } { Delphi公用函数单元 } { } { 版权所有 (C) 2008 } ...
- SQL Server Window Function 窗体函数读书笔记二 - A Detailed Look at Window Functions
这一章主要是介绍 窗体中的 Aggregate 函数, Rank 函数, Distribution 函数以及 Offset 函数. Window Aggregate 函数 Window Aggrega ...
- Delphi 消息函数 SendMessage函数
Delphi中SendMessage使用说明 SendMessage基础知识 函数功能:该函数将指定的消息发送到一个或多个窗口.此函数为指定的窗口调用窗口程序,直到窗口程序处理完消息再返回.而函数Po ...
- delphi编程实现为Windows窗口标题栏添加新按钮
下面我们就讨论一下在delphi中如何给窗口的标题栏上添加新的按钮. 一.实现起来要定义以下过程: 1. 定义DrawCaptButton过程,这个过程的功能是在指定的位置画出按钮. 在过程中要使用w ...
- (转载)delphi 常用函数(数学)
delphi 常用函数(数学) Delphi中怎么将实数取整? floor 和 ceil 是 math unit 里的函数,使用前要先 Uses Math.trunc 和 round 是 system ...
随机推荐
- window.onload中失效的问题
在页面中,我们有时候想让页面加载的时候有多个JS事件,一般的时候我们会这样做 window.onload=function(){ alert("aaa"); } window.on ...
- 【leetcode】756. Pyramid Transition Matrix
题目如下: We are stacking blocks to form a pyramid. Each block has a color which is a one letter string, ...
- SQL 内部连接
内部链接INNER JOIN关键字选择两个表中具有匹配值的记录. SQL INNER JOIN 语法 SELECT column_name(s) FROM table1 INNER JOIN tabl ...
- oralce存储过程
简单的存储 create or replace procedure sayhelloworld as begin dbms_output.put_line('Hello World'); end;
- Qt 无法连接mysql数据库的问题
错误信息: QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL ...
- hdu 1402 A * B Problem Plus (FFT模板)
A * B Problem Plus Problem Description Calculate A * B. Input Each line will contain two integers A ...
- Python每日一题 005
任一个英文的纯文本文件,统计其中的单词出现的个数. 代码 # coding:utf-8 import re def get_word(filename): fp=open(filename," ...
- Python之-在字典、列表、集合中刷选数据
一.元组.字典.列表的遍历 1.元组遍历 元组的遍历借助 range() 函数,基本思想是通过元组的长度使用for循环进行遍历 #troup s = ["aaa","bb ...
- angularjs $index用来取顺序
$index用来取顺序 null
- 一起探讨下POST、GET请求
以下的讨论都是基于java和Spring MVC,主要记录自己的一些练习心得. 做web网站开发HTTP请求必不可少,一直在使用写好的Utils没有考虑过如何以及为什么,现在闲下来想着捋一捋java的 ...