Показать сообщение отдельно
  #7  
Старый 13.07.2012, 11:37
Pyro Pyro вне форума
Так проходящий
 
Регистрация: 18.07.2011
Сообщения: 805
Версия Delphi: 7Lite
Репутация: 6063
По умолчанию

этой функцией можно
Код:
{$R *.dfm}

function GetClass(h: hWnd): string;
var
  ClassName: array[0..255] of char;
begin
  FillChar(ClassName, sizeof(ClassName), 0);
  GetClassName(h, ClassName, 255);
  result := strpas(ClassName);
end;


var
  FoundCount: Integer;
  FindNum: integer;
  FindWho: string;
  FoundHandle111: Cardinal;                                                   //0-last
function EnumFor(ParentHandle: Cardinal; TargetClass: string; index_from_1: Byte=0): Cardinal;
  function Enumka(h: hWnd; p: Pointer): BOOL; stdcall;
  begin
    result := true;
    if FindNum <> 0 then
    begin
      if GetClass(h) = FindWho then
        inc(FoundCount);
      if FoundCount = FindNum then
      begin
        FoundHandle111 := h;
        result := false;
      end
    end else
    if GetClass(h) = FindWho then
      FoundHandle111 := h
  end;
begin
  FindWho := TargetClass;
  FindNum := index_from_1;
  FoundCount := 0;
  FoundHandle111 := INVALID_HANDLE_VALUE;
  EnumChildWindows(ParentHandle, @Enumka, 0);
  result := FoundHandle111;
end;
Ответить с цитированием