DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: hxh57738897
今日帖子: 32
在线用户: 19
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 Another (Another) ★☆☆☆☆ -
盒子活跃会员
2003/5/18 18:10:17
标题:
求助: EnumChildWindows的用法? 浏览:2719
加入我的收藏
楼主: 试了几遍都不行?
真次!
----------------------------------------------
按此在新窗口浏览图片
作者:
男 boy (阿門) ★☆☆☆☆ -
盒子活跃会员
2003/5/18 19:11:09
1楼: 不對題不要罵我

How to use EnumChildWindows function?

Relation: [ WinApi ]
ID: [ 000400 ]  
I suggest that you do as follows. Please make shure that in the compiler
options you select smart callbacks ON. Or use the compiler directive as I
included it here.

{$K+}          { smart callbacks on}
unit WndX;

interface
uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs;

function FWC(P: integer; C: String; I: integer): integer;
function EnumChildProc(HWnd: integer; lParam: longint): Boolean;
function Left(inString : String; numChars : Byte) : String;

implementation

var
   Counter  : integer;
   Cnt      : Integer;
   FWCWnd   : integer;
   CMatch   : array[0..254] of char;


function EnumChildProc(HWnd: Integer; lParam: longint): Boolean; export;   {
must be declared export }
var 
   ClsName  : array[0..31] of char;
   ClsLen   : Integer;
begin
   GetClassName(HWnd, ClsName, 31);
   If strcomp(ClsName, CMatch) = 0 then 
      Counter := Counter + 1;
   Result := Counter <> cnt;
   if not result then
      FWCWnd := HWnd;
   end;


function FWC(P: integer; C: string; I: integer): integer;
begin
   FWCWnd := 0;
   strpcopy(CMatch, C);       { convert from string to ASCIIZ }
   Cnt := I;
   EnumChildWindows(P, @EnumChildProc, 0); { no need for makeprocinstance! }
   FWC := FWCWnd;
   end;

end.

----------------------------------------------
Delphi開發◆伺服器架設◆免安裝APACHE,PHP,CGI Perl, MYSQL ★
作者:
男 Another (Another) ★☆☆☆☆ -
盒子活跃会员
2003/5/19 10:33:02
2楼: 己成功了!
谢谢Boy!

----------------------------------------------
按此在新窗口浏览图片
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行70.3125毫秒 RSS