【发布时间】:2015-03-12 01:00:18
【问题描述】:
我必须将用户输入的用户名和密码保存到文本文件中,但它会创建文本文件并在用户输入之前保存文本。 (因此创建了空文本文件)。
我想我必须对程序做一些事情,但是虽然我搜索了解决方案,但我找不到。
我的代码:
[Code]
var
Page: TInputQueryWizardPage;
username: String;
password: String;
procedure InitializeWizard;
begin
{ Create the page }
Page := CreateInputQueryPage(wpWelcome,
'Username & Password', 'Username like : e201600',
'Please enter your username and password.');
{ Add items (False means it's not a password edit) }
Page.Add('Username:', False);
Page.Add('Password:', True);
{ Set initial values (optional) }
Page.Values[0] := ExpandConstant('hello5');
Page.Values[1] := ExpandConstant('');
{ Read values into variables }
username := Page.Values[0];
password := Page.Values[1];
SaveStringToFile('c:\filename.txt', username+#13#10+password+#13#10, False);
end;
【问题讨论】: