/[projects]/dao/DelphiScanner/Components/tpsystools_4.04/examples/CBuilder/exmmfcu.cpp
ViewVC logotype

Contents of /dao/DelphiScanner/Components/tpsystools_4.04/examples/CBuilder/exmmfcu.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2671 - (show annotations) (download)
Tue Aug 25 18:15:15 2015 UTC (8 years, 9 months ago) by torben
File size: 2694 byte(s)
Added tpsystools component
1 // ***** BEGIN LICENSE BLOCK *****
2 // * Version: MPL 1.1
3 // *
4 // * The contents of this file are subject to the Mozilla Public License Version
5 // * 1.1 (the "License"); you may not use this file except in compliance with
6 // * the License. You may obtain a copy of the License at
7 // * http://www.mozilla.org/MPL/
8 // *
9 // * Software distributed under the License is distributed on an "AS IS" basis,
10 // * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 // * for the specific language governing rights and limitations under the
12 // * License.
13 // *
14 // * The Original Code is TurboPower SysTools
15 // *
16 // * The Initial Developer of the Original Code is
17 // * TurboPower Software
18 // *
19 // * Portions created by the Initial Developer are Copyright (C) 1996-2002
20 // * the Initial Developer. All Rights Reserved.
21 // *
22 // * Contributor(s):
23 // *
24 // * ***** END LICENSE BLOCK *****
25 //---------------------------------------------------------------------------
26 #include <vcl\vcl.h>
27 #pragma hdrstop
28
29 #include "exmmfcu.h"
30 #pragma link "ststrms"
31 //---------------------------------------------------------------------------
32 #pragma resource "*.dfm"
33 TForm1 *Form1;
34 //---------------------------------------------------------------------------
35 __fastcall TForm1::TForm1(TComponent* Owner)
36 : TForm(Owner)
37 {
38 }
39 //---------------------------------------------------------------------------
40 void __fastcall TForm1::btnOpenMMFClick(TObject *Sender)
41 {
42 try {
43 AMMFile = new TStMemoryMappedFile("", 100, false, true);
44 btnOpenMMF->Enabled = false;
45 btnCloseMMF->Enabled = true;
46 Timer1->Enabled = true;
47 Label1->Caption = "Waiting: ";
48 }
49 catch (...) {
50 ShowMessage("Unable to open file");
51 }
52 }
53 //---------------------------------------------------------------------------
54 void __fastcall TForm1::btnCloseMMFClick(TObject *Sender)
55 {
56 delete AMMFile;
57 AMMFile = NULL;
58
59 btnOpenMMF->Enabled = true;
60 btnCloseMMF->Enabled = false;
61 Timer1->Enabled = false;
62 }
63 //---------------------------------------------------------------------------
64 void __fastcall TForm1::Timer1Timer(TObject *Sender)
65 {
66 Label1->Caption = "Seeking: " + IntToStr(AMMFile->DataSize);
67 Timer1->Enabled = false;
68 AMMFile->Seek(0, soFromBeginning);
69 AMMFile->Read(Buf, AMMFile->DataSize);
70 Edit1->Text = StrPas(Buf);
71 Timer1->Enabled = true;
72 }
73 //---------------------------------------------------------------------------
74 void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
75 {
76 delete AMMFile;
77 AMMFile = NULL;
78 }
79 //---------------------------------------------------------------------------

  ViewVC Help
Powered by ViewVC 1.1.20