27 #define _TnbREPORT_Viewer_ON
30#if defined(_WIN32_WCE) && defined(_TnbREPORT_Viewer_ON)
31 #undef _TnbREPORT_Viewer_ON
43#define TNBVIW_KIND_RS232C (0x01<<24)
44#define TNBVIW_KIND_SOCK_S (0x02<<24)
45#define TNBVIW_KIND_SOCK_C (0x03<<24)
46#define TNBVIW_KIND_SOCK_U (0x04<<24)
47#define TNBVIW_KIND_MAILS (0x05<<24)
48#define TNBVIW_KIND_USB (0x06<<24)
49#define TNBVIW_KIND_FILE (0x07<<24)
50#define TNBVIW_KIND_TEMP (0x08<<24)
51#define TNBVIW_KIND_PIPE (0x09<<24)
52#define TNBVIW_KIND_COPYDATA (0x0B<<24)
53#define TNBVIW_KIND_ATOM (0x0F<<24)
54#define TNBVIW_DIRE_SEND 0
55#define TNBVIW_DIRE_RECV (int(1<<23))
56#define TNBVIW_TYPE_BIN 0
57#define TNBVIW_TYPE_TEXT (int(1<<22))
58#define TNBVIW_TYPE_RAWTEXT (int(1<<21))
59#define TNBVIW_PORT(P) (P)
62#define TNB_TNBVIEWER_WND_TITLE "TnbCommViewer"
63#define TNB_TNBVIEWER_WND_CLASS "TnbReport"
66#define WM_TNBVIEWER_CMD (WM_APP)
67#define WM_TNBVIEWER_DATA1 (WM_APP+1)
68#define WM_TNBVIEWER_DATA2 (WM_APP+2)
69#define WM_TNBVIEWER_DATA3 (WM_APP+3)
70#define WM_TNBVIEWER_DATA4 (WM_APP+4)
105 #ifdef _TnbREPORT_Viewer_ON
106 m_hPostWnd = ::FindWindow(NULL, _T(TNB_TNBVIEWER_WND_TITLE));
117 #ifdef _TnbREPORT_Viewer_ON
118 return m_hPostWnd != 0;
131 #ifdef _TnbREPORT_Viewer_ON
142 void ToViewer(
size_t sizeData, LPCVOID lpcvData, DWORD cookie)
144 #ifdef _TnbREPORT_Viewer_ON
145 if ( m_hPostWnd != NULL )
147 m_ToViewer(
static_cast<DWORD
>(cookie & ~TNBVIW_TYPE_TEXT), sizeData, lpcvData);
159 #ifdef _TnbREPORT_Viewer_ON
160 if ( m_hPostWnd != NULL )
166 m_ToViewer(
static_cast<DWORD
>(cookie | TNBVIW_TYPE_TEXT), asc.
GetLength() + 1, asc.operator LPCSTR());
169 m_ToViewer(
static_cast<DWORD
>(cookie | TNBVIW_TYPE_TEXT), strlen(lpszText) + 1, lpszText);
177 #ifdef _TnbREPORT_Viewer_ON
181 void m_PostMessage(UINT message, WPARAM wParam, LPARAM lParam)
183 BOOL r = ::PostMessage(m_hPostWnd, message, wParam, lParam);
186 _GetLastError(
"PostMessage");
195 void m_ToViewer(DWORD cookie,
size_t dataSize, LPCVOID lpcvData)
197 if ( ! ::IsWindow(m_hPostWnd) )
203 const BYTE* B =
static_cast<const BYTE*
>(lpcvData);
204 size_t l = dataSize / 4;
205 for (
size_t i = 0; i < l; i++ )
207 const DWORD* W =
reinterpret_cast<const DWORD*
>(B);
208 m_PostMessage(WM_TNBVIEWER_DATA4, cookie, *W);
211 switch ( dataSize & 3 )
217 m_PostMessage(WM_TNBVIEWER_DATA1, cookie, B[0]);
220 m_PostMessage(WM_TNBVIEWER_DATA2, cookie, B[0] | (B[1] << 8));
223 m_PostMessage(WM_TNBVIEWER_DATA3, cookie, B[0] | (B[1] << 8) | (B[2] << 16));
283 ATOM a = ::GlobalAddAtom(lpszTitle);
291 m_cookieBase = TNBVIW_KIND_ATOM | m_atom;
304 return m_cookieBase != 0;
333 void ToViewer(
size_t sizeData, LPCVOID lpcvData, DWORD dire = 0)
336 m_viewer.
ToViewer(sizeData, lpcvData, dire | m_cookieBase);
346 m_viewer.
ToViewer(lpszText, TNBVIW_TYPE_RAWTEXT | m_cookieBase);
351 void m_DeleteAtom(
void)
353 if ( m_atom != NULL )
355 ::GlobalDeleteAtom(m_atom);
bool HasKind(void) const
[確認] 種類設定済み確認.
~CReportViewerEx(void)
デストラクタ
void Invalid(void)
[設定] 無効化.
bool IsValid(void) const
[確認] 有効確認.
void ToViewer(LPCTSTR lpszText)
[出力] 文字列出力.
CReportViewerEx(void)
コンストラクタ.
bool SetKind(LPCTSTR lpszTitle)
[設定] 種類設定.
void SetKind(DWORD kind)
[設定] 種類設定.
void ToViewer(size_t sizeData, LPCVOID lpcvData, DWORD dire=0)
[出力] ダンプ出力.
void ToViewer(size_t sizeData, LPCVOID lpcvData, DWORD cookie)
[出力] ダンプ出力.
void Invalid(void)
[設定] 無効化.
bool IsValid(void) const
[確認] 有効確認.
CReportViewer(void)
コンストラクタ.
void ToViewer(LPCTSTR lpszText, DWORD cookie)
[出力] 文字列出力.
bool IsEmpty(void) const
[確認] 空チェック
size_t GetLength(void) const
[取得] 文字列長
#define EXCLUSIVE(CLS)
簡易排他制御マクロ.