License.cpp 1.4 KB

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