Topic: Кнопка-ссылка

Подскажите как сделать кнопку-гиперссылку, чтобы по нажатию открывалась папка/файл на локальном сервере?

Re: Кнопка-ссылка

Assuming the file link is not in a database and you just want to click on a button to open a file or folder, try


var
  fName :string;
 dir : TOpenDialog;

begin

    dir := TOpenDialog.Create(nil); {Creates and instance of TOpenDialog using dir as the variable}

    try
        
        fName := dir.files;   {Get the file name that is selected in the Open Dialog form}
        
        OpenFile(fName);  {This will open the file with whatever the default program is for the file}
     finally
      dir.Free;    {Free all the resources.
      
end;

There are many other options that can be used with both TOpenDialog and OpenFile. For example you can set a default folder to search, or a filter to only search for certain file types.  You can also if needed allow multiple selecting of files, but as the code above stands, the OpenFile function wouldn't work then.


Предполагая, что ссылка на файл отсутствует в базе данных, и вы просто хотите нажать кнопку, чтобы открыть файл или папку, попробуйте.


Есть много других опций, которые можно использовать как с TOpenDialog, так и с OpenFile. Например, вы можете установить папку по умолчанию для поиска или фильтр для поиска только определенных типов файлов. Вы также можете, если необходимо, разрешить множественный выбор файлов, но, как показывает приведенный выше код, функция OpenFile тогда не будет работать.

On a clear disk you can seek forever