Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2218 sbetterm 1
//---------------------------------------------------------------------------
2
 
3
#include <vcl.h>
4
#pragma hdrstop
5
 
6
#include "Login.h"
7
#include "Registry.hpp"
8
 
9
//---------------------------------------------------------------------------
10
#pragma package(smart_init)
11
#pragma resource "*.dfm"
12
TLoginForm *LoginForm;
13
//---------------------------------------------------------------------------
14
__fastcall TLoginForm::TLoginForm(TComponent* Owner)
15
	: TForm(Owner)
16
{
17
}
18
//---------------------------------------------------------------------------
19
void __fastcall TLoginForm::FormShow(TObject *Sender)
20
{
21
    TRegistry   *registry = NULL;
22
 
23
    try
24
    {
25
        registry = new TRegistry();
26
        registry->RootKey = HKEY_CURRENT_USER;
27
 
28
        // True because we want to create it if it doesn't exist
29
        registry->OpenKey("Software\\ERG\\TxnTestManager", true);
30
        AnsiString  last_user = registry->ReadString("LastUser");
31
 
32
        if (last_user.IsEmpty())
33
        {
34
        	last_user = "integration";
35
        }
36
 
37
        UsernameEdit->Text = last_user;
38
        PasswordEdit->SetFocus();
39
    }
40
    __finally
41
    {
42
        delete registry;
43
    }
44
}
45
//---------------------------------------------------------------------------
46
void __fastcall TLoginForm::LoginOKBtnClick(TObject *Sender)
47
{
48
    TRegistry   *registry = NULL;
49
 
50
    try
51
    {
52
        registry = new TRegistry();
53
        registry->RootKey = HKEY_CURRENT_USER;
54
 
55
        // True because we want to create it if it doesn't exist
56
        registry->OpenKey("Software\\ERG\\TxnTestManager", true);
57
        registry->WriteString("LastUser", UsernameEdit->Text);
58
    }
59
    __finally
60
    {
61
        delete registry;
62
    }
63
}
64
//---------------------------------------------------------------------------
65