我想知道该函数的详细用法
还有第2个参数指向的回调函数在什么情况下会被调用。
还有第2个参数指向的回调函数在什么情况下会被调用。
解决方案 »
- delphi 7 如何在程序外的光标处输出一段字符串和数字?大侠们告诉我该怎么做啊?谢谢了...
- 排序问题
- 想请问各位:在程序中是否能自定义水晶报表?请大侠们给一些指导和建议。谢谢。
- 急问有关mscomm的字节和位关系
- 如何通过程序给TQuery增加一个CalcFields
- 怎样在程序内执行DOS的内部命令?WINEXEC好象不行啊。
- 如何在DELPHI中引入DLL?
- 急!Record/key deleted错误原因?
- 怎样用api设置PageControl的Multiline属性?
- 用showmodal,窗口上的gifimage的动画能正常显示, 但用show时,窗口的gifimage动画就停止变成了静止图了. 怎么办?
- ADO的鼠标指针问题
- 远程数据模块中添加的接口方法应当用 safecall 还是 stdcall 调用方式?
HWND hWndParent, // 已经获得的父窗口句柄。
WNDENUMPROC lpEnumFunc, // 回调函数地址。
LPARAM lParam // 自定义值
);BOOL CALLBACK EnumChildProc(
HWND hwnd, // 子窗口句柄。
LPARAM lParam // 前面的自定义值。
);加入已经获得了一个主窗口:hWnd,编写代码:
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
{
//对窗口做出判断的代码
return TRUE; //继续枚举,FALSE 停止.
}
EnumChildWindows(hWnd, EnumChildProc, 0);
Form1: TForm1;implementationprocedure TForm1.EnumerateChildWindows1Click(Sender: TObject);
begin
{empty our list box}
ListBox1.Items.Clear; {enumerate all child windows belonging to Form1}
EnumChildWindows(Form1.Handle,@EnumerateChildWindows,0);end;{these steps execute for every child window belonging to the parent}
function EnumerateChildWindows(hWnd: HWND; lParam: LPARAM): BOOL;
var
ClassName: Array[0..255] of char; // this holds the class name of our child windows
begin
{get the class name of the given child window}
GetClassName(hWnd,ClassName,255); {display it in the list box}
Form1.ListBox1.Items.Add(ClassName); {continue enumeration}
Result:=TRUE;
end;
Re: 关于EnumChildWindows的用法!
ID=230963, 发贴富翁: Billy, 2000-04-25 15:56:00
定义一个回调函数:
function EnumChildProc(Myhwnd: HWND; lParam: LPARAM): Boolean;stdCall;
begin
//你的代码
Result:=False;//设为True则停止
end;
在程序中调用:
enumchildwindows(hWndProgram,@EnumChildProc,0);//hWndProgram为父窗口的句柄
WNDENUMPROC lpEnumFunc, // 回调函数
LPARAM lParam // 参数
);BOOL CALLBACK EnumChildProc( HWND hwnd, // 找到的窗体的句柄
LPARAM lParam // 参数(由EnumChildWindows传来的)
);
当找到窗体时调用回调函数,利用lparam可以传递任何东西,就当作指针用吧