知道控件的Handle值,怎么获知此控件的类型,并根据相应的控件类设置相应的属性值?请高手们赐教!!!

解决方案 »

  1.   

    var
      WindowList: TList;function GetWindows(
        handle: HWND; // handle to parent window
        info: LPARAM  // application-defined value
       ): Boolean; stdcall;
    begin   {}
      Result := True;
      WindowList.Add(Pointer(handle));
    end;function GetWinClass(whandle: HWnd): string;
    var
      i: integer;
      Dest: array [0..80] of char;
    begin
      Result := '';
      WindowList := TList.Create();
      EnumWindows(@GetWindows, 0);
      for i := 0 to WindowList.Count - 1 do
      if HWnd(WindowList[i]) = whandle then
      begin
        if GetClassName(Hwnd(WindowList[i]), Dest, Sizeof(Dest) - 1) > 0 then
        begin
          Result := Dest;
          Break;
        end;
      end;
      WindowList.Free();
    end;
      

  2.   

    这样即可
    function GetWinClass(whandle: HWnd): string;
    var
      i: integer;
      Dest: array [0..80] of char;
    begin
      Result := '';
      if GetClassName(whandle, Dest, Sizeof(Dest) - 1) > 0 then
      begin
        Result := Dest;
        Break;
      end;
    end;
      

  3.   

    windows.GetClassName( )
    设置相应控件所有的属性值,is very difficult,but you can use api set visilbe, caption ,border, enabled property.