Показать сообщение отдельно
  #7  
Старый 26.09.2011, 10:42
Аватар для Delphist
Delphist Delphist вне форума
Новичок
 
Регистрация: 10.12.2010
Адрес: Курган
Сообщения: 68
Репутация: 6002
По умолчанию

"Я в инженеры бы пошел, пусть меня научат!!!!)))"
Код:
unit Unit1;//Имя модуля

interface

uses//После этого слова идет перечисление подключаемых модулей 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type//после этого объяснение типов
  TForm1 = class(TForm)
//здесь описывается компоненты исобытия
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);

  private//После этого слова можно описывать закрытые данные объектов
    { Private declarations }//подсказка!!!!!!! которую сгенерировал Delphi
  public//После этого можно описать открытые данные объекта
    { Public declarations }//Подсказка!!!!!!!


//Здесь можно описать переменные и методы доступные из другого модуля

  end;

Тож самое только для второго модуля
unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, inifiles;

type
  TForm2 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Edit3: TEdit;
    Label3: TLabel;
    Button1: TButton;
    Label4: TLabel;
    ComboBox1: TComboBox;
    Label5: TLabel;
    Edit4: TEdit;
    Label6: TLabel;
    procedure Button1Click(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}
//Событие по нажатию кнопкп Button1
procedure TForm2.Button1Click(Sender: TObject);
//Объявление переменных используемые в этом событие  
var
  fio,a:string;
  b,c:string;
  f: textFile;
  pref:integer;
  Ini: Tinifile;
//Начало выполнения события
begin
Ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini'); //Инициализация Ini файла 

fio:=Edit1.Text;
a:=Edit1.Text;
b:=Edit2.Text;
c:=Edit3.Text;
//Проверка на правельность ввода данных b и c
if b<>c then  label4.Caption:='Пароли не совпадают.'
   else label4.Caption:='Регистрация успешно завершина.';
case combobox1.itemindex of
0:pref:=1;
1:pref:=2;
2:pref:=3;
end;
//заносим данные из пременных a и b в ини файл
Ini.WriteString('login','log',a);
Ini.Writestring('login','parol',b);
Ini.WriteInteger('login','pref',pref);
Form2.Close;//закрытие формы Form2
end;



end.
unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, inifiles;

type
  TForm3 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Edit2: TEdit;
    Button1: TButton;
    Label3: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

uses Unit4;

{$R *.dfm}

procedure TForm3.Button1Click(Sender: TObject);
var
a,b:string;
log,parol:string;
Ini: Tinifile;
c:integer;
f:string;
begin
Ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
a:=Ini.Readstring('login','log','default value');
b:= Ini.Readstring('login','parol','default value');
c:=Ini.Readinteger('login','pref',10);
str(c,f);
log:=edit1.Text;
parol:=edit2.text;
if (a=log) and (b=parol) then begin
Form4:=TForm4.Create(Application);
 Form4.Caption:='Вход';
 Form4.Visible:=true;
 form4.Label1.Caption:='уровень доступа='+f;
 end else label3.caption:='логин или пароль не верны';
end;

end.
unit Unit4;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm4 = class(TForm)
    Label1: TLabel;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form4: TForm4;

implementation

{$R *.dfm}

end.


Чего тут не понятного??? Надеюсь в подобии слов разберешься??? Ты инженер какой инженер????
Ответить с цитированием