License.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef NO_RESOURCES
  13. #pragma resource "*.dfm"
  14. #endif
  15. //---------------------------------------------------------------------------
  16. UnicodeString LicenseStr[2] =
  17. { L"LICENSE", L"LICENSE_EXPAT" };
  18. //---------------------------------------------------------------------------
  19. void __fastcall DoLicenseDialog(TLicense License)
  20. {
  21. TLicenseDialog * LicenseDialog = NULL;
  22. try
  23. {
  24. LicenseDialog = new TLicenseDialog(Application, License);
  25. LicenseDialog->ShowModal();
  26. }
  27. __finally
  28. {
  29. delete LicenseDialog;
  30. }
  31. }
  32. //---------------------------------------------------------------------------
  33. __fastcall TLicenseDialog::TLicenseDialog(TComponent * Owner, TLicense License)
  34. : TForm(Owner)
  35. {
  36. UseSystemSettings(this);
  37. TStrings * LicenseList = new TStringList();
  38. try
  39. {
  40. LicenseList->Text = ReadResource(LicenseStr[License]);
  41. DebugAssert(LicenseList->Count > 0);
  42. Caption = FMTLOAD(LICENSE_CAPTION, (LicenseList->Strings[0]));
  43. LicenseList->Delete(0);
  44. LicenseMemo->Lines->Text = LicenseList->Text;
  45. }
  46. __finally
  47. {
  48. delete LicenseList;
  49. }
  50. }