OSDN Git Service

first commit
[dokopop/dokopop.git] / DCHookTest / OCRTextFrm.cpp
1 //---------------------------------------------------------------------------
2
3 #include <vcl.h>
4 #pragma hdrstop
5
6 #include "OCRTextFrm.h"
7 #include "Util.h"
8 //---------------------------------------------------------------------------
9 #pragma package(smart_init)
10 #pragma link "TntStdCtrls"
11 #pragma link "TntStdCtrls"
12 #pragma resource "*.dfm"
13 TOCRTextForm *OCRTextForm;
14 const char *sOCRText = "OCRText";
15 //---------------------------------------------------------------------------
16 __fastcall TOCRTextForm::TOCRTextForm(TComponent* Owner)
17         : TForm(Owner)
18 {
19         VCL_SIZEABLE();
20 }
21 //---------------------------------------------------------------------------
22 void __fastcall TOCRTextForm::FormShow(TObject *Sender)
23 {
24         LoadForm(sOCRText, this, NULL);
25 }
26 //---------------------------------------------------------------------------
27 void __fastcall TOCRTextForm::FormCloseQuery(TObject *Sender,
28       bool &CanClose)
29 {
30         SaveForm(sOCRText, this, NULL);
31 }
32 //---------------------------------------------------------------------------
33 void TOCRTextForm::SetText(const wchar_t *text)
34 {
35         int wlen = wcslen(text);
36         char *buf = new char[wlen*2+1];
37         if (!buf) return;
38         BOOL defchar = FALSE;
39         WideCharToMultiByte( CP_ACP, 0,
40                 text, wlen,
41                 buf, wlen*2+1, 0, &defchar );
42         memo->Text = buf;
43         delete[] buf;
44 }
45
46