pokusavam sa EnumChildWindows funkcijom (rekurzivno) prodjem kroz sve kontrole nekog prozora, ali dobijem samo manji deo njih. Npr, TMenuItem-si se ne izlistaju, TToolbarButton-s takodje. Jel zna neko kako to uraditi
Tnx
Btw, koristion sam sledeci kod (sa torry-ja):
type
PMyEnumParam = ^TMyEnumParam;
TMyEnumParam = record
Nodes: TTreeNodes;
Current: TTreeNode;
end;
function EnumWindowsProc(Wnd: HWND; Param: PMyEnumParam): BOOL; stdcall;
const
MyMaxName = 64;
MyMaxText = 64;
var
ParamChild: TMyEnumParam;
ClassName: string;
WindowText: string;
begin
Result := True;
SetLength(ClassName, MyMaxName);
SetLength(ClassName, GetClassName(Wnd, PChar(ClassName), MyMaxName));
SetLength(WindowText, MyMaxText);
SetLength(WindowText, SendMessage(Wnd, WM_GETTEXT, MyMaxText, lParam(PChar(WindowText))));
ParamChild.Nodes := Param.Nodes;
ParamChild.Current := Param.Nodes.AddChildObject(Param.Current,
'[' + ClassName + '] "' + WindowText + '"' + ' Handle: ' + IntToStr(Wnd), Pointer(Wnd));
EnumChildWindows(Wnd, @EnumWindowsProc, lParam(@ParamChild));
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Param: TMyEnumParam;
begin
Param.Nodes := TreeView1.Items;
Param.Current := TreeView1.TopItem;
TreeView1.Items.BeginUpdate;
EnumWindows(@EnumWindowsProc, lParam(@Param));
TreeView1.Items.EndUpdate;
end;