unit Getspcchildhwd;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; wincls=class
public
childhw:integer;
function get_childhw(mainhw:integer;childclass:integer):integer;
function enumchildwindowsproc(hw:integer;clsstr:integer):boolean;stdcall;
end;
var
Form1: TForm1;
mainwin:wincls;
implementation{$R *.dfm}
function wincls.get_childhw(mainhw:integer;childclass:integer):integer;
begin
enumchildwindows(mainhw,@wincls.enumchildwindowsproc,childclass);
result:=childhw;
end;function wincls.enumchildwindowsproc(hw:integer;clsstr:integer):boolean;stdcall;
var
recallclsname:pchar;
begin
getmem(recallclsname,256);
getclassname(hw,recallclsname,255);
if recallclsname=pchar(clsstr) then
begin
childhw:=hw;
result:=false;
end
else
result:=true; freemem(recallclsname);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
mainwin:=wincls.Create;
edit2.Text:=inttohex(mainwin.get_childhw(form1.Handle,integer(pchar(edit1.Text))),8);
end;end.请大虾指教
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; wincls=class
public
childhw:integer;
function get_childhw(mainhw:integer;childclass:integer):integer;
function enumchildwindowsproc(hw:integer;clsstr:integer):boolean;stdcall;
end;
var
Form1: TForm1;
mainwin:wincls;
implementation{$R *.dfm}
function wincls.get_childhw(mainhw:integer;childclass:integer):integer;
begin
enumchildwindows(mainhw,@wincls.enumchildwindowsproc,childclass);
result:=childhw;
end;function wincls.enumchildwindowsproc(hw:integer;clsstr:integer):boolean;stdcall;
var
recallclsname:pchar;
begin
getmem(recallclsname,256);
getclassname(hw,recallclsname,255);
if recallclsname=pchar(clsstr) then
begin
childhw:=hw;
result:=false;
end
else
result:=true; freemem(recallclsname);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
mainwin:=wincls.Create;
edit2.Text:=inttohex(mainwin.get_childhw(form1.Handle,integer(pchar(edit1.Text))),8);
end;end.请大虾指教
解决方案 »
- 如何检测文件下载完成
- 请教delphi中使用access数据库进行数据导入的问题
- Access violation at address 004c658A in module'FC.exe' read of address 00000000.
- 串口设备改装为USB接口时,程序如何编程?
- 如何在SQL字符串中用UPDATE更新日期型字段值?
- 关于Access数据库的访问速度的问题
- 如何在窗体上输出数值,文字等?
- 如何动态修改Access数据库
- 数据库中数据类型和DELPHI中数据类型转换得问题!
- 动态数组问题
- quickreport数据库字段求和问题!
- 问一个分布式事务的问题(同时对SQL Server和Oracle操作)
遍历form用下面的代码即可
for i:=0 to Screen.FormCount-1 do begin
ShowMessage(Screen.Forms[i].Caption);
end;
我要找子窗口啊!!
我的问题是:
当我用函数写的时候 Lparm 参数可以从enumchildwindows传到
eumchildwindowsproc中
但我要是写在类中 为什么 Lparm 不能从enumchildwindows传到wincls.enumchildwindosproc中啊????