unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ShlObj, ShellAPI,
ActiveX;
Type
REinst =
record
Aktiv, Tray, Fenster, IndiB, WinStart :boolean;
IndiS :
String[255];
AutoUp :integer;
end;
type
TForm1 =
class(TForm)
btn: TButton;
procedure btnClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Var
Einst :REinst;
function GetSpecialFolder (aFolder: Integer):
String;
var
pIdL: PItemIDList;
Path:
Array [0..Max_Path]
of Char;
Allocator: IMalloc;
begin
// ItemIdList für den Ordner holen
SHGetSpecialFolderLocation (0, aFolder, pIdL);
// ItemIdList in String umwandeln lassen
SHGetPathFromIDList (pIDL, Path);
// Speicher wieder freigeben
if Succeeded (SHGetMalloc (Allocator))
then
begin
Allocator.Free (pIdL);
{$IFDEF VER100}
Allocator.Release;
{$ENDIF}
end;
Result := Path;
end;
procedure TForm1.btnClick(Sender: TObject);
Var
f :
file of REinst;
Path :
string;
begin
with Einst
do
begin
//Daten in "Einst" speichern
end;
Path := GetSpecialFolder(CSIDL_APPDATA)+'
\Einst.dat';
AssignFile(f, Path);
ReWrite(f);
Write(f,Einst);
CloseFile(f);
end;
end.