- unit Main;
- interface
- uses
- Winapi.Windows, Winapi.Messages,
- System.SysUtils, System.Variants, System.Classes,
- Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls,Vcl.StdCtrls;
- type TfmUnity = class(TForm)
- pg: TPageControl;
- TabSheet1: TTabSheet;
- tabOptions: TTabSheet;
- gbField: TGroupBox;
- editField: TEdit;
- procedure gbFieldClick(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private { Private declarations }
- public { Public declarations }
- end;
- uses
- var fmUnity: TfmUnity;
- implementation
- uses Registry, FileCtrl; //путь к файлу
- {$R *.dfm}
- procedure ЗаписатьВРеестр(val:string; name:string=
Str1
;project:string=namespace_unity
);- var reg : tregistry;
- begin
- reg := tregistry.create;
- try
- reg.RootKey := HKEY_CURRENT_USER; reg.OpenKey(
Software\Microsoft\Windows\
+project,true); - reg.WriteString(name, val);
- reg.RootKey := HKEY_CURRENT_USER; reg.OpenKey(
- finally
- reg.free;
- end;
- end;
- function ПрочитатьВРеестре(name:string=
Str1
;project:string=namespace_unity
):string;- var reg : tregistry;
- begin
- reg := tregistry.create;
- try
- reg.RootKey := HKEY_CURRENT_USER;
- reg.OpenKey(
Software\Microsoft\Windows\
+project,true); - Result := reg.ReadString(name);
- finally
- reg.free;
- end;
- end;
- procedure TfmUnity.FormCreate(Sender: TObject);
- begin
- editField.Text:=ПрочитатьВРеестре(
i
+editField.tag.ToString());
- editField.Text:=ПрочитатьВРеестре(
- end;
- begin
- procedure TfmUnity.gbFieldClick(Sender: TObject);
- var SelectedFolder: string;
- begin
- if (SelectDirectory(
Выберите директорию
,»,SelectedFolder)) then- begin
- editField.Text:=SelectedFolder;
- ЗаписатьВРеестр(SelectedFolder,
i
+editField.tag.ToString());
- end;
- begin
- if (SelectDirectory(
- end;
- interface
- end.
Рубрика: Desktop App development
Разработка настольных приложений