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 |
#include <stfirst.hpp>
|
28 |
#include <ststrl.hpp>
|
29 |
#pragma hdrstop
|
30 |
|
31 |
#include "exfirstu.h"
|
32 |
//---------------------------------------------------------------------------
|
33 |
#pragma link "StwmDCpy"
|
34 |
#pragma link "StBase"
|
35 |
#pragma link "StStrL"
|
36 |
#pragma link "StWmDCpy"
|
37 |
#pragma resource "*.dfm"
|
38 |
TForm1 *Form1;
|
39 |
//---------------------------------------------------------------------------
|
40 |
__fastcall TForm1::TForm1(TComponent* Owner)
|
41 |
: TForm(Owner)
|
42 |
{
|
43 |
}
|
44 |
//---------------------------------------------------------------------------
|
45 |
void __fastcall TForm1::StWMDataCopy1DataReceived(TObject *Sender,
|
46 |
tagCOPYDATASTRUCT &CopyData)
|
47 |
{
|
48 |
AnsiString S;
|
49 |
unsigned I;
|
50 |
|
51 |
S = (char*)CopyData.lpData;
|
52 |
I = 0;
|
53 |
if (StrChPosL(S, ' ', I))
|
54 |
S = StrStCopyL(S, I+1, S.Length()-I);
|
55 |
else {
|
56 |
if (StrChPosL(S, 0x9, I))
|
57 |
S = StrStCopyL(S, I+1, S.Length()-I);
|
58 |
}
|
59 |
if (I > 0)
|
60 |
DoFileOpen(S);
|
61 |
}
|
62 |
//---------------------------------------------------------------------------
|
63 |
void __fastcall TForm1::btnLoadFileClick(TObject *Sender)
|
64 |
{
|
65 |
if (OpenDialog1->Execute())
|
66 |
Memo1->Lines->LoadFromFile(OpenDialog1->FileName);
|
67 |
}
|
68 |
//---------------------------------------------------------------------------
|
69 |
void __fastcall TForm1::FormCreate(TObject *Sender)
|
70 |
{
|
71 |
if (ParamCount > 0)
|
72 |
DoFileOpen(ParamStr(1));
|
73 |
}
|
74 |
//---------------------------------------------------------------------------
|
75 |
void __fastcall TForm1::DoFileOpen(ShortString FN)
|
76 |
{
|
77 |
Memo1->Clear();
|
78 |
if (FileExists(FN))
|
79 |
Memo1->Lines->LoadFromFile(FN);
|
80 |
} |