Delphi 获取句柄 sendmessage
查找另外一个窗口的句柄: 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);
var a,b:PAnsiChar;
h:HWND;
begin
h:= FindWindow(nil,'abc.txt -
相关文档:
同步程序案例
procedure TGetOrderThread.PostDB(webnr:WideString);
var
Err: String;
SetWebnr:WideString;
xmlDoc: IXMLDocument;
root: IXMLNode;
rowc: IXMLNode;//记录数
rows: IXMLNodeList;//主记录列表
row: IXMLNode;
drows: IXMLNodeList;// ......
类的事件
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMyEvent = procedure of object; //不带参数的过程
TMyEventExt = procedure(AName: string) of object; //带参数的过程
TForm1 = class(TForm)
......
设置字体的过程
Procedure TForm1.FontDlgApply(Sender:Tobject);
begin
Button1.Font:= FontDialog1.Font;
end;
该程序只有当用户按动About框的按钮或被About窗控制图标关闭窗口后,才会回到主窗体中,而不能与第一个窗体发生交互行为。这就是方法Show和ShowModal的主要不同之处
集合类型是一群相同类型元素的组合 ......