Ver Mensaje Individual
  #2  
Antiguo 10-08-2004
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is online now
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.279
Reputación: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Cita:
Empezado por soul6301
¿Qué componente o unidad me permite mostrar la ventana donde aparecen los directorios de Mi PC?
Puedes utilizar los componentes de la paleta Samples llamados ShellTreeView, ShellComboBox y ShellListView; Son sencillos, aunque en la versión 6 de delphiu (desconozco en las demás) tienen algún pequeño Bug. Échales un vistazo, son bastante fáciles de configurar.

Otra opción por código es utilizar una función existente en la unit FileCtrl (que deberás añadir al uses)

Código Delphi [-]
var
  Dir : String;
begin
  SelectDirectory(Dir,[],0);
  ShowMessage(Dir);

y otra opción es utilizar directamnte la API de windows SHBrowseForFolder

Código Delphi [-]
var
  TitleName : string;
  lpItemID : PItemIDList;
  BrowseInfo : TBrowseInfo;
  DisplayName : array[0..MAX_PATH] of char;
  TempPath : array[0..MAX_PATH] of char;
begin
  // Inicializar
  FillChar(BrowseInfo, sizeof(TBrowseInfo), #0);
  BrowseInfo.hwndOwner := Form1.Handle;
  BrowseInfo.pszDisplayName := @DisplayName;
  // Título para tu ventana de seleccion
  TitleName := 'Please specify a directory';
  BrowseInfo.lpszTitle := PChar(TitleName);
  // Diferentes opciones (mira la API), hay diferentes valores:
  // BIF_BROWSEFORCOMPUTER (SOLO ORDENADORES),
  // BIF_BROWSEFORPRINTER (Sólo impresoras),
  // BIF_DONTGOBELOWDOMAIN (no incluidos los de red),
  // BIF_RETURNFSANCESTORS (el botón de OK se desactiva si la selección dno es correcta),
  // BIF_RETURNONLYFSDIRS (sólo enseña directorios),
  // BIF_STATUSTEXT
  BrowseInfo.ulFlags := BIF_RETURNONLYFSDIRS;
  lpItemID := SHBrowseForFolder(BrowseInfo);
  // Se ha selecconado algo?
  if lpItemId <> nil then begin
    SHGetPathFromIDList(lpItemID, TempPath);
    ShowMessage(TempPath);
    GlobalFreePtr(lpItemID);
  end;

en éste último caso deberás añadir la unit ShellAPI al uses.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita