License.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <Common.h>
  5. #include <TextsWin.h>
  6. #include <VCLCommon.h>
  7. #include "WinInterface.h"
  8. #include "License.h"
  9. #include "Tools.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma resource "*.dfm"
  13. //---------------------------------------------------------------------------
  14. UnicodeString LicenseStr[2] =
  15. { L"LICENSE", L"LICENSE_EXPAT" };
  16. //---------------------------------------------------------------------------
  17. void __fastcall DoLicenseDialog(TLicense License)
  18. {
  19. TLicenseDialog * LicenseDialog = NULL;
  20. try
  21. {
  22. LicenseDialog = new TLicenseDialog(Application, License);
  23. LicenseDialog->ShowModal();
  24. }
  25. __finally
  26. {
  27. delete LicenseDialog;
  28. }
  29. }
  30. //---------------------------------------------------------------------------
  31. __fastcall TLicenseDialog::TLicenseDialog(TComponent * Owner, TLicense License)
  32. : TForm(Owner)
  33. {
  34. UseSystemSettings(this);
  35. TStrings * LicenseList = new TStringList();
  36. try
  37. {
  38. LicenseList->Text = ReadResource(LicenseStr[License]);
  39. DebugAssert(LicenseList->Count > 0);
  40. Caption = FMTLOAD(LICENSE_CAPTION, (LicenseList->Strings[0]));
  41. LicenseList->Delete(0);
  42. LicenseMemo->Lines->Text = LicenseList->Text;
  43. }
  44. __finally
  45. {
  46. delete LicenseList;
  47. }
  48. }