Delphi获取句柄
发布时间:2011-06-16
转载文章请标明出处: http://code.01yun.com/asp0dm/asp0net0dm/20110616/55395.html
查找另外一个窗口的句柄: handle := FindWindow(nil,PChar('窗口 的标题'));//查到窗体句柄
查找子窗体:childHandle := FindWindowEx(handle,0,'子窗体类',' 子窗体标题');
另外有个枚举子窗体的API,EnumChildWindows(主创体句柄,@回调函 数,用户参数);
用这个函数需要自己写一个回调的函数,比如:
function EnumChildProc(ahWND:HWND; param:LPARAM):boolean; stdcall;
sendmessage(handle,message,wl,rl)
unit Unit1;
interface
uses Windows, Messages,Tlhelp32, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject