Put a TOpenDialog component on your form, and change any parameters to the file types you want, the title of the dialog etc. There are a range of options to set as well.
Then with a suitable buttons OnClick event:
[tt]
procedure TF_Main.B_open_errorClick(Sender: TObject);
begin
OpenDialog.InitialDir := MyDir; // set your path
OpenDialog.FileName := ''; // your initial file mask
OpenDialog.FilterIndex := 1; // you can have multiple extension mask
// this uses the first (not zero based)
if OpenDialog.Execute then // execute the dialog
begin
if not (ofExtensionDifferent in OpenDialog_errors.Options) then
begin
{do something here with the default extension}
end
else
begin
{do something if a different extension}
end
end //if OpenDialog
end;
[/tt]
There is of course help for that component.
I don't know Kazza - but this sounds like a version of Windows Explorer, where you open select a directory and it displays the contents, or the My Documents button in Office apps. Am I getting closer to what you mean?
Don't know of a specific WinAPI function, but you could do the same with FindFirst and FindNext and fill a string grid with the contents. There is an example of this in the FindFirst help
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.