Advertisement

Untitled

May 30th, 2015
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <windows.h>
  4. #include <fstream>
  5. #include <iostream>
  6. #include <string>
  7. #include <cstdlib>
  8. #pragma hdrstop
  9. using namespace std;
  10.  
  11. #include "Unit1.h"
  12. //---------------------------------------------------------------------------
  13. #pragma package(smart_init)
  14. #pragma resource "*.dfm"
  15. TForm1 *Form1;
  16.  
  17. string current_value;
  18. ifstream NewFile;
  19.  
  20. //---------------------------------------------------------------------------
  21. __fastcall TForm1::TForm1(TComponent* Owner)
  22.     : TForm(Owner)
  23. {
  24. }
  25. //---------------------------------------------------------------------------
  26. void __fastcall TForm1::startButtonClick(TObject *Sender)
  27. {
  28.     startDiode->Brush->Color = clGreen;
  29.  
  30.     //if(NewFile.is_open() == true)
  31.     //{
  32.         getline(NewFile, current_value);
  33.         int current_position = atoi(current_value.c_str());
  34.         indicator->Position = current_position;
  35.     //}
  36.     //else
  37.     //{
  38.     //  Close();
  39.     //}
  40. }
  41. //---------------------------------------------------------------------------
  42. void __fastcall TForm1::stopButtonClick(TObject *Sender)
  43. {
  44.     stopDiode->Brush->Color = clRed;
  45.     startDiode->Brush->Color = clWhite;
  46. }
  47. //---------------------------------------------------------------------------
  48. void __fastcall TForm1::offButtonClick(TObject *Sender)
  49. {
  50.     startDiode->Brush->Color = clWhite;
  51.     stopDiode->Brush->Color = clWhite;
  52.     NewFile.close();
  53. }
  54. //---------------------------------------------------------------------------
  55. void __fastcall TForm1::powerButtonClick(TObject *Sender)
  56. {
  57.     char file_name [MAX_PATH];
  58.  
  59.     OpenTextFileDialog1->Execute();
  60.     NewFile.open(file_name);
  61. }
  62. //---------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement