unit U_AboutRF;

interface

uses
  Windows, U_LNG, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  ShellAPI, Dialogs, StdCtrls, ExtCtrls, ComCtrls, siComp, siLngLnk,
  EnJpgGr;

const
  {$IF Defined (SCS_RF)}
    URL = 'www.expertsoft.ru';
    eMail = 'info@expertsoft.ru';
    Tel = '+7 (495) 543-7-618';
  {$ELSE}
    URL = 'www.expertsoft.com.ua';
    eMail = 'office@expertsoft.com.ua';
    Tel = '(044) 233-0-234';
  {$IFEND}

type
  TF_About = class(TForm)
    lblWeb: TLabel;
    lblEmail: TLabel;
    lblVersion: TLabel;
    lblCaptionProgID: TLabel;
    lblProgID: TLabel;
    lng_Forms: TsiLangLinked;
    lblTelephone: TLabel;
    ImageTELECOM: TImage;
    ImageSCS: TImage;
    ImageSCSNiko: TImage;
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure lblWebClick(Sender: TObject);
    procedure lblEmailClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ImageSCSNikoClick(Sender: TObject);
    procedure lblEmailMouseEnter(Sender: TObject);
    procedure lblEmailMouseLeave(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  F_About: TF_About;

implementation

uses U_Common, U_Main, U_Protection, U_ProtectionCommon;

{$R *.dfm}


procedure OpenUrl(s: string='');
var
  SHI : TShellExecuteInfo;
begin
  try
    ZeroMemory(@SHI, sizeof(SHI));
    SHI.cbSize := sizeof(SHI);
    SHI.fMask := SEE_MASK_NOCLOSEPROCESS;
    SHI.Wnd := Application.Handle;
    SHI.lpVerb := PChar('Open');
    if s = '' then
      SHI.lpFile := PChar(URL)
    else
      SHI.lpFile := PChar(s);
    SHI.lpParameters := nil;
    SHI.lpDirectory := nil;
    ShellExecuteEx(@SHI);
  except

  end;
end;

procedure OpenMail(s: string='');
var
  SHI : TShellExecuteInfo;
  tmpstr: string;
begin
  try
    ZeroMemory(@SHI, sizeof(SHI));
    SHI.cbSize := sizeof(SHI);
    SHI.fMask := SEE_MASK_NOCLOSEPROCESS;
    SHI.Wnd := Application.Handle;
    SHI.lpVerb := PChar('Open');
    if s = '' then
      SHI.lpFile := PChar('mailto:' + eMail)
    else
    begin
      tmpstr := 'mailto:' + s;
      SHI.lpFile := PChar(tmpstr);
    end;
    SHI.lpParameters := nil;
    SHI.lpDirectory := nil;
    ShellExecuteEx(@SHI);
  except

  end;
end;

procedure TF_About.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = VK_ESCAPE then
    ModalResult := mrOk;
  if Key = VK_RETURN then
    ModalResult := mrOk;
end;

procedure TF_About.lblWebClick(Sender: TObject);
begin
  OpenUrl;
end;

procedure TF_About.lblEmailClick(Sender: TObject);
begin
  OpenMail;
end;

procedure TF_About.FormCreate(Sender: TObject);
var
  s: string;
begin
  try
    lblVersion.Caption := VersionEXE;
    s := ProgID.Data1 + '-' + ProgID.Data2 + '-' +
                      ProgID.Data3 + '-' + ProgID.Data4 + '-' + DateID;
    lblProgID.Caption := FormatForUser(s);
  except
  end;
end;

procedure TF_About.ImageSCSNikoClick(Sender: TObject);
begin
  ModalResult := mrOk;
end;

procedure TF_About.lblEmailMouseEnter(Sender: TObject);
begin
  TLabel(Sender).Font.Style := TLabel(Sender).Font.Style + [fsUnderline];
end;

procedure TF_About.lblEmailMouseLeave(Sender: TObject);
begin
  TLabel(Sender).Font.Style := TLabel(Sender).Font.Style - [fsUnderline];
end;

procedure TF_About.FormShow(Sender: TObject);
begin
  lblTelephone.Caption := Tel;
  {$IF Defined(TELECOM)}
  imageSCS.Visible := False;
  imageSCSNiko.Visible  := False;
  imageTelecom.visible := True;
  {$ELSE}
    {$IF Defined(OEM_NIKOMAX)}
      imageTelecom.visible := False;
      imageSCS.Visible  := False;
      imageSCSNiko.Visible  := True;
    {$ELSE}
      imageTelecom.visible := False;
      imageSCSNiko.Visible  := False;
      imageSCS.Visible  := True;
    {$IFEND}
  {$IFEND}
end;

end.
