procedure Tmainfrm.N2Click(Sender: TObject);
var
h:thandle;
begin
h:=findwindow('tmainfrm',nil);
if findwindowex(h,0,'Tmemberfrm',nil)<>0 then
begin
ShowMessage('找到该窗口');
endend;我的mainfrm主窗口程序中有个memberfrm子窗口,但上面程序就是不执行showmessage这条语句
我试了一下,h:=findwindow('tmainfrm',nil)是能找到主窗口的,但为什么findwindowex(h,0,'Tmemberfrm',nil)为什么就找不到子窗口呢,请问这条语句是哪里写错了????
var
h:thandle;
begin
h:=findwindow('tmainfrm',nil);
if findwindowex(h,0,'Tmemberfrm',nil)<>0 then
begin
ShowMessage('找到该窗口');
endend;我的mainfrm主窗口程序中有个memberfrm子窗口,但上面程序就是不执行showmessage这条语句
我试了一下,h:=findwindow('tmainfrm',nil)是能找到主窗口的,但为什么findwindowex(h,0,'Tmemberfrm',nil)为什么就找不到子窗口呢,请问这条语句是哪里写错了????
解决方案 »
- delphi字符转控件类型
- 关于 idtcpserver 监听线程
- 快!简单问题大放分!!文件目录的搜索方法和算法是什么?
- 到底是怎么回事呀!
- 如何让ActionManager做的菜单中的某一个菜单项的Enalbed设为false,就是让某一菜单项为灰,不让使用???我没有找到Enabled的属性呀??
- delphi如何调用附件中的画图功能?
- csdn上每个论坛都只能看最近300个帖子,但如果想看更多的帖子呢呢,除了用搜索还有其他方法吗
- toolbar97 for Delphi5的控件,急!!!!!!!!!!!!!
- 怎样去掉form的滚动条?
- 如何COPY记录:
- 讨论:判断函数返回值用 not 呢还是用 = false 呢?
- DSPack的VideoCapture問題
unit main;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus,member;type
Tmainfrm = class(TForm)
MainMenu1: TMainMenu;
ch1: TMenuItem;
ch2: TMenuItem;
procedure ch2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
mainfrm: Tmainfrm;implementation{$R *.dfm}procedure Tmainfrm.ch2Click(Sender: TObject);
begin
var
h:thandle;
begin
h:=findwindow('tmainfrm',nil);
if findwindowex(h,0,'Tmemberfrm',nil)<>0 then
begin
ShowMessage('找到该窗口');
endend;end.
子窗体单元
unit member;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
Tmemberfrm = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;var
memberfrm: Tmemberfrm;implementation{$R *.dfm}procedure Tmemberfrm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
self.Free;
end;end.我的完速代码就这样