License.cpp 1.4 KB

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