08/04/10 18:40:58
>>282
普通のアプリと同じように「ローカルアプリケーションフォルダ」に入れるのがよいのではないでしょうか。
usesにShlObjを追加して…
{ 現在のユーザーアカウントの「ローカルアプリケーションフォルダ」のパスを返す.}
function GetLocalAppDataPath: string;
var buf: array [0..MAX_PATH] of char;
begin
SHGetSpecialFolderPath(0, buf, CSIDL_LOCAL_APPDATA, False);
Result := buf;
end;
{ 現在のユーザーアカウント名を返す.}
function GetCurrentUserName: string;
var
buf: array [0..MAX_PATH] of char;
size: dword;
begin
size := MAX_PATH;
GetUserName(buf, size);
Result := buf;
end;
{ 実行例 }
procedure TForm1.ShowAppDataPathActionExecute(Sender: TObject);
var Path: string;
begin
if LabeledEdit_CompanyName.Text = '' then raise Exception.Create('社名はちゃんと入れろよ!');
if LabeledEdit_AppName.Text = '' then raise Exception.Create('アプリ名もちゃんと入れろよ!');
Path := GetLocalAppDataPath + '\' + LabeledEdit_CompanyName.Text + '\' + LabeledEdit_AppName.Text;
ShowMessageFmt('このパソコンの場合,ユーザー%sの設定ファイルは'#13#13'%s'#13#13'の下に保存すべきじゃ',
[GetCurrentUserName, Path]);
end;