T
T
Timoxa6362014-04-20 14:22:15
Delphi
Timoxa636, 2014-04-20 14:22:15

Running files that are in different folders "below the program itself"?

Good day to all, people need your help ... I
created a program,
63503cb3aeda4c3fbbfc381e506efabe.png
please tell me the tag for the buttons for attaching the "exe" file to each button ...
and another question, as far as I understand the file for "exe" will be written in full, and you can somehow replace it, because the program itself with the necessary files will travel around the computer ... and so that the address is not rewritten every time, can this be specified from the directory?38dfe15ab25f4b49a8ad7ed7b72ca8ff.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis, 2014-04-20
@uscr

And on a relative path it is impossible to start?
Type: "\core_x32\file.exe".

A
Andrey Vershinin, 2014-04-20
@WolfdalE

Use configuration files. In uses - IniFiles.
File example:

[Database]
user_name=SYSDBA
password=masterkey
locale=win1251
location=C:\DB.fdb

Usage:
procedure TDMDatabase.DataModuleCreate(Sender: TObject);
var
  ini : TIniFile;
  login : String;
  pass : String;
  location : String;
  locale : String;

begin
  ini := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'config.ini');

  try
    login := ini.ReadString('Database', 'username', 'SYSDBA');
    pass := ini.ReadString('Database', 'password', 'masterkey');
    location := ini.ReadString('Database', 'location', 'localhost:' + ExtractFilePath(Application.ExeName) + '\DB.fdb');
    locale := ini.ReadString('Database', 'locale', 'WIN1251');
  finally
    ini.Free;
  end;

//Используем полученные переменные

By "fixing the file" as I understand it, you mean launching the application? If yes then use ShellExecute on OnClick.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question