home *** CD-ROM | disk | FTP | other *** search
/ Kompuutteri K-CD 2002 #1 / K-CD_2002-01.iso / Delphi / INFO / Extras / RegCleanUtility / Source / Unit1.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-05-22  |  2.2 KB  |  66 lines

  1. //---------------------------------------------------------------------------
  2.  
  3. #include <vcl.h>
  4. #pragma hdrstop
  5. #include "D6RegClean.h"
  6. #include "Unit1.h"
  7. #include "Unit2.h"
  8. //---------------------------------------------------------------------------
  9. #pragma package(smart_init)
  10. #pragma resource "*.dfm"
  11. TForm1 *Form1;
  12. //---------------------------------------------------------------------------
  13. __fastcall TForm1::TForm1(TComponent* Owner)
  14.     : TForm(Owner)
  15. {
  16. }
  17. //---------------------------------------------------------------------------
  18.  
  19.  
  20. void __fastcall TForm1::Button2Click(TObject *Sender)
  21. {
  22.     Application->Terminate();
  23. }
  24. //---------------------------------------------------------------------------
  25. void __fastcall TForm1::ValidateConditions(TObject *Sender)
  26. {
  27.     LPOSVERSIONINFO osvi = new OSVERSIONINFO;
  28.     TRegistry *Reg = new TRegistry;
  29.  
  30.     Reg->RootKey = HKEY_CURRENT_USER;
  31.     osvi->dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  32.     if (GetVersionEx(osvi)) {
  33.         if (osvi->dwPlatformId == VER_PLATFORM_WIN32_NT) {
  34.             if (Reg->OpenKey("Software\\Borland\\Delphi\\6.0", false)) {
  35.                 Form1->Button1->Enabled = true;
  36.                 Reg->CloseKey();
  37.             } else {
  38.                 MessageBox(NULL, LoadStr(MSG_APPNOTFOUND).c_str(), NULL, MB_OK | MB_TOPMOST | MB_ICONSTOP);
  39.             }
  40.         } else {
  41.             MessageBox(NULL, LoadStr(MSG_NTONLY).c_str(), NULL, MB_OK | MB_TOPMOST | MB_ICONSTOP);
  42.         }
  43.     } else {
  44.         MessageBox(NULL, LoadStr(MSG_UNKNOWNOS).c_str(), NULL, MB_OK | MB_TOPMOST | MB_ICONSTOP);
  45.     }
  46.  
  47.     delete osvi;
  48.     delete Reg;
  49.  
  50. }
  51. //---------------------------------------------------------------------------
  52. void __fastcall TForm1::Button1Click(TObject *Sender)
  53. {
  54.     int nResponse;
  55.  
  56.     nResponse = MessageBox(NULL, LoadStr(MSG_WARNING).c_str(), LoadStr(TITLE_WARNING).c_str(), MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2 | MB_TOPMOST);
  57.     if (nResponse == ID_NO) {
  58.         Application->Terminate();
  59.     } else {
  60.             Form2->Show();
  61.             this->Hide();
  62.     }
  63. }
  64. //---------------------------------------------------------------------------
  65.  
  66.