Hvis du ændre den til flg. skulle det virke:
procedure TForm1.Button1Click(Sender: TObject);
var
menu:TMenuitem;
Drive: Char;
DriveLetter: String[4];
begin
PopupMenu1.Items.Clear;
Menu := TMenuItem.Create(PopupMenu1);
Menu.Caption := 'CD';
PopupMenu1.Items.Add(Menu);
for Drive := 'A' to 'Z' do begin
DriveLetter := Drive;
case GetDriveType(PChar(Drive + ':\\')) of
DRIVE_CDROM: begin
menu := TMenuitem.Create(PopupMenu1);
menu.Caption := Driveletter + ':';
PopupMenu1.Items.Items[0].Add(Menu);
end;
end;
end;
end;
MH.
The-Freak
Livet er for kort til at kede sig.