随笔 - 2146  文章 - 19 评论 - 11846 阅读 - 1267万

随笔分类 -  API 窗口函数

详解 EnumWindows 与 EnumWindowsProc - 回复 "SplendourChiang" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2009/10/16/1584488.html#1727205// EnumWindows 的功能是遍历所有顶层窗口function EnumWindows( lpEnumFunc: TFNWndEnumProc; {回调函数指针} lParam: LPARAM {给回调函数的参数, 它对应回调函数的第二个参数}... 阅读全文
posted @ 2009-12-18 13:22 万一 阅读(14356) 评论(16) 推荐(0) 编辑
GetForegroundWindow 与 GetActiveWindow 的区别 - 回复 "delphier" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/12/13/1081644.html#1400835 GetActiveWindow 只是获取当前程序中(严格地说是线程中)被激活的窗口; GetForegroundWindow 是获取当前系统中被激活的窗口. 两个函数的级别不一样, 一个是线程级、一个是系统级. 被激活的窗口不一定是顶层窗口(最上面... 阅读全文
posted @ 2008-12-13 16:23 万一 阅读(14422) 评论(13) 推荐(0) 编辑
获取一个窗口的所有子窗口(包括嵌套) - 回复 "asian" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/12/10/1345752.html#1397451 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls... 阅读全文
posted @ 2008-12-11 09:42 万一 阅读(6436) 评论(8) 推荐(0) 编辑
获取窗口矩形的四种方法: GetClientRect、ClientRect、GetWindowRect、BoundsRect
摘要:其中 GetClientRect、ClientRect 获取的是窗口的客户区矩形; GetWindowRect、BoundsRect 是获取窗口矩形; 另外, 还有一个 Windows.GetClientRect(使用方法同 GetWindowRect, 它们都是 API 函数), 这里使用的 GetClientRect 是 Forms.GetClientRect. 本例效果图: unit... 阅读全文
posted @ 2008-05-29 12:31 万一 阅读(18841) 评论(0) 推荐(0) 编辑
WinAPI: SetLayeredWindowAttributes - 设置窗口的透明
摘要:这是来宾 Dolby 在 http://www.cnblogs.com/del/archive/2008/03/08/1081295.html#1096814 询问的问题. //声明: SetLayeredWindowAttributes( Hwnd: THandle; {窗口句柄} crKey: COLORREF; {透明色} bAlpha: Byte; {Alpha ... 阅读全文
posted @ 2008-03-08 22:23 万一 阅读(13306) 评论(27) 推荐(0) 编辑
WinAPI: FindWindow、FindWindowEx - 查找窗口
摘要:FindWindow( lpClassName, {窗口的类名} lpWindowName: PChar {窗口的标题} ): HWND; {返回窗口的句柄; 失败返回 0} //FindWindowEx 比 FindWindow 多出两个句柄参数: FindWindowEx( Parent: HWND; {要查找子窗口的父窗口句柄}... 阅读全文
posted @ 2008-02-28 21:51 万一 阅读(123872) 评论(39) 推荐(2) 编辑
WinAPI: GetClassName - 获取指定窗口的类名
摘要://声明: GetClassName( hWnd: HWND; {指定窗口句柄} lpClassName: PChar; {缓冲区} nMaxCount: Integer {缓冲区大小} ): Integer; {返回类名大小; 失败返回 0} //测试1: 新建一个工程, 主窗口的类名默认是 TForm1, 用程序获取一下看看 var ... 阅读全文
posted @ 2008-02-28 21:25 万一 阅读(34612) 评论(15) 推荐(0) 编辑
WinAPI: GetNextWindow - 获取指定窗口Z上或Z下的窗口的句柄
摘要://声明: GetNextWindow( hWnd: HWND; {指定的窗口句柄} uCmd: UINT {指定的关系选项} ): HWND; {失败返回0; 成功返回符合的窗口句柄} //uCmd 可选值: GW_HWNDNEXT = 2; {同级别 Z 序之下} GW_HWNDPREV = 3; {同级别 Z 序之上} 这是 GetWindow 的简化. 阅读全文
posted @ 2008-02-28 14:45 万一 阅读(5927) 评论(3) 推荐(0) 编辑
WinAPI: GetTopWindow - 获取指定窗口的子窗口中最顶层的窗口句柄
摘要://声明: GetTopWindow( hWnd: HWND; {指定的窗口句柄} ): HWND; {失败返回0; 成功返回最顶层的子窗口句柄} 这和用 GetWindow 函数使用 GW_CHILD 参数时应该是一样的, 测试一下: var h1,h2: HWND; begin h1 := GetTopWindow(GetDesktopWindow); h... 阅读全文
posted @ 2008-02-28 14:30 万一 阅读(15756) 评论(7) 推荐(0) 编辑
WinAPI: GetWindow - 获取与指定窗口具有指定关系的窗口的句柄
摘要://声明: GetWindow( hWnd: HWND; {指定的窗口句柄} uCmd: UINT {指定的关系选项} ): HWND; {失败返回0; 成功返回符合的窗口句柄} //uCmd 可选值: GW_HWNDFIRST = 0; {同级别第一个} GW_HWNDLAST = 1; {同级别最后一个} GW_HWNDNEXT = 2; {同级别下一个} GW_H... 阅读全文
posted @ 2008-02-28 14:02 万一 阅读(15248) 评论(7) 推荐(0) 编辑
WinAPI: GetForegroundWindow - 获取前台窗口的句柄
摘要://声明: GetForegroundWindow: HWND; //举例: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = clas... 阅读全文
posted @ 2008-02-26 09:52 万一 阅读(13122) 评论(21) 推荐(0) 编辑
WinAPI: GetWindowTextLength - 获取窗口标题长度
摘要://声明: GetWindowTextLength( hWnd: HWND {窗口句柄} ): Integer; {返回窗口标题长度} //举例: var i: Integer; begin i := GetWindowTextLength(Self.Handle); ShowMessage(IntToStr(i)); end; 阅读全文
posted @ 2008-02-07 16:30 万一 阅读(4023) 评论(0) 推荐(0) 编辑
WinAPI: GetWindowText - 获取窗口标题
摘要://声明: GetWindowText( hWnd: HWND; {窗口句柄} lpString: PChar; {接收文本的缓冲区的指针} nMaxCount: Integer {指定缓冲区大小, 其中包含NULL字符; 如果文本超出,会被被截断} ): Integer; {返回字符个数, 不包括中断的空字符; 如果标题为空或句柄无效, 则返回零... 阅读全文
posted @ 2008-02-07 11:36 万一 阅读(18050) 评论(22) 推荐(1) 编辑
WinAPI: SetWindowText - 设置窗口标题
摘要://声明: SetWindowText( hWnd: HWND; {窗口句柄} lpString: PChar {新标题串指针} ): BOOL; //举例: var s: string; begin s := '新标题'; SetWindowText(Handle, PAnsiChar(s)); end; 阅读全文
posted @ 2008-02-07 10:48 万一 阅读(11744) 评论(4) 推荐(0) 编辑
WinAPI: GetDesktopWindow - 返回桌面窗口的句柄
摘要://声明: GetDesktopWindow: HWND; {无参数; 返回桌面窗口的句柄} //举例: var h: HWND; begin h := GetDesktopWindow; ShowMessage(IntToStr(h)); end; 阅读全文
posted @ 2008-02-07 10:26 万一 阅读(6844) 评论(1) 推荐(0) 编辑



点击右上角即可分享
微信分享提示