This is function to get menu caption, disable and enabled some menu, using loop we check if the component is class of tmenuitem we do something as we like, enabled, caption or another property

procedure TFrmMain.checkmenu;
var i:integer;

begin
for i
:=0 to FrmMain.componentcount-1 do
begin
if FrmMain.components[i] is tmenuitem then
begin
with FrmMain.components[i] as tmenuitem do
begin
if (caption=’-') then enabled:=true
else
if (caption=’Login’) then enabled:=true
else
if (caption=’Logout’) then enabled:=true
else
if (caption=’Exit’) then enabled:=true
else
enabled:=false;
end;
end;
end;
end;