home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / ObjRepos / LogoApp / LOGOMAIN.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  3.2 KB  |  112 lines

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