home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / LOGO.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-20  |  3.6 KB  |  116 lines

  1. //---------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "About.h"
  6. #include "Logo.h"
  7. #include "LogoStrs.h"
  8. #include "MAPI.hpp"
  9. //---------------------------------------------------------------------
  10. #pragma resource "*.dfm"
  11. TLogoAppForm *LogoAppForm;
  12. //---------------------------------------------------------------------
  13. template class TOpenOptions;
  14. //---------------------------------------------------------------------
  15. __fastcall TLogoAppForm::TLogoAppForm(TComponent *Owner)
  16.   : TForm(Owner)
  17. {
  18. }
  19. //---------------------------------------------------------------------
  20. void __fastcall TLogoAppForm::FormCreate(TObject *Sender)
  21. {
  22.   Application->OnHint = ShowHint;
  23. }
  24. //---------------------------------------------------------------------
  25. void __fastcall TLogoAppForm::FileNew(TObject *Sender)
  26. {
  27.   FFileName = LoadStr(sUntitled);
  28.   RichEdit1->Lines->Clear();
  29.   RichEdit1->Modified = false;
  30. }
  31. //---------------------------------------------------------------------
  32. void __fastcall TLogoAppForm::FileOpen(TObject *Sender)
  33. {
  34.   if (OpenDialog->Execute())
  35.   {
  36.     RichEdit1->Lines->LoadFromFile(OpenDialog->FileName);
  37.     FFileName = OpenDialog->FileName;
  38.     RichEdit1->SetFocus();
  39.     RichEdit1->Modified = false;
  40.     RichEdit1->ReadOnly = OpenDialog->Options.Contains(ofReadOnly);
  41.   }
  42. }
  43. //---------------------------------------------------------------------
  44. void __fastcall TLogoAppForm::FileSave(TObject *Sender)
  45. {
  46.   if (FFileName == LoadStr(sUntitled))
  47.     FileSaveAs(Sender);
  48.   else
  49.   {
  50.     RichEdit1->Lines->SaveToFile(FFileName);
  51.     RichEdit1->Modified = false;
  52.   }
  53. }
  54. //---------------------------------------------------------------------
  55. void __fastcall TLogoAppForm::FileSaveAs(TObject *Sender)
  56. {
  57.   String str;
  58.   TVarRec vrs[1];
  59.  
  60.   if (SaveDialog->Execute())
  61.   {
  62.     if (FileExists(SaveDialog->FileName))
  63.     {
  64.       str = FmtLoadStr(sOverwrite, OPENARRAY(TVarRec, (SaveDialog->FileName)));
  65.       if (MessageDlg(str, mtConfirmation, TMsgDlgButtons() << mbYes << mbNo <<
  66.         mbCancel, 0) != IDYES)
  67.           return;
  68.     }
  69.     RichEdit1->Lines->SaveToFile(SaveDialog->FileName);
  70.     FFileName = SaveDialog->FileName;
  71.     RichEdit1->Modified = false;
  72.   }
  73. }
  74. //---------------------------------------------------------------------
  75. void __fastcall TLogoAppForm::FileSend(TObject *Sender)
  76. {
  77.   TMapiMessage MapiMessage;
  78.   Cardinal MError;
  79.  
  80.   MapiMessage.ulReserved = 0;
  81.   MapiMessage.lpszSubject = NULL;
  82.   MapiMessage.lpszNoteText = RichEdit1->Lines->Text.c_str();
  83.   MapiMessage.lpszMessageType = NULL;
  84.   MapiMessage.lpszDateReceived = NULL;
  85.   MapiMessage.lpszConversationID = NULL;
  86.   MapiMessage.flFlags = 0;
  87.   MapiMessage.lpOriginator = NULL;
  88.   MapiMessage.nRecipCount = 0;
  89.   MapiMessage.lpRecips = NULL;
  90.   MapiMessage.nFileCount = 0;
  91.   MapiMessage.lpFiles = NULL;
  92.  
  93.   MError = MapiSendMail(0, 0, MapiMessage, MAPI_DIALOG | MAPI_LOGON_UI |
  94.     MAPI_NEW_SESSION, 0);
  95.  
  96.   if (MError)
  97.     MessageDlg(LoadStr(sSendError), mtError, TMsgDlgButtons() << mbOK, 0);
  98. }
  99. //---------------------------------------------------------------------
  100. void __fastcall TLogoAppForm::FileExit(TObject *Sender)
  101. {
  102.   Close();
  103. }
  104. //---------------------------------------------------------------------
  105. void __fastcall TLogoAppForm::About(TObject *Sender)
  106. {
  107.   AboutBox->ShowModal();
  108. }
  109. //---------------------------------------------------------------------
  110. void __fastcall TLogoAppForm::ShowHint(TObject *Sender)
  111. {
  112.   StatusBar->SimpleText = Application->Hint;
  113. }
  114. //---------------------------------------------------------------------
  115.  
  116.