2012년 4월 6일 금요일

INI 파일 생성

사용자에게 Username과 Password를 입력 받아 INI 파일로 기록하는 방법입니다.

[AUTH]
USERNAME=이름
PASSWORD=password

형식으로 INI파일을 생성함.

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{82C8C949-44A8-49C4-8CED-8DD0ACD0DCCF}
AppName=My Program
AppVerName=My Program 1.5
AppPublisher=My Company, Inc.
AppPublisherURL=http://www.example.com/
AppSupportURL=http://www.example.com/
AppUpdatesURL=http://www.example.com/
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[INI]
Filename: {app}\prefs.ini; Section: AUTH; Key: USERNAME; String: {code:GetUserName}
Filename: {app}\prefs.ini; Section: AUTH; Key: PASSWORD; String: {code:GetPassword}


[code]
var
AuthPage : TInputQueryWizardPage;

procedure InitializeWizard;
begin
AuthPage := CreateInputQueryPage(wpWelcome,
    'Account Information', 'Please enter your Account Information',
    '');
  AuthPage.Add('Username:', False);
  AuthPage.Add('Password:', True);
end;

function AuthForm_NextButtonClick(Page: TWizardPage): Boolean;
begin
  Result := True;
end;

function GetUserName(Param: String): string;
begin
result := AuthPage.Values[0];
end;

function GetPassword(Param: String): string;
begin
result := AuthPage.Values[1];
end;

댓글 없음:

댓글 쓰기