TNB Library
TnbWindowPrinter.h
[詳解]
1#pragma once
11#include "TnbDynamicFunc.h"
12
13
14
15//TNB Library
16namespace TNB
17{
18
19
20
32{
33 bool m_hasPrintWindow;
34public:
36 CWindowPrinter(void) : m_hasPrintWindow(true)
37 {
38 }
39
48 bool PrintWindow(HWND hWnd, HDC hdc, bool isClientOnly = true)
49 {
50 bool r = false;
51 if ( m_hasPrintWindow )
52 {
53 try
54 {
55 typedef BOOL (WINAPI* P_PrintWindow)(HWND, HDC, UINT);
56 CDynamicFuncT<P_PrintWindow> pw("USER32.DLL", "PrintWindow");
57 r = !! pw()(hWnd, hdc, isClientOnly ? 1/*PW_CLIENTONLY*/ : 0);
58 }
59 catch ( CNullPointerException& e )
60 {
61 e.OnCatch();
62 m_hasPrintWindow = false;
63 }
64 }
65 if ( ! m_hasPrintWindow )
66 {
67 UINT message = isClientOnly ? WM_PRINTCLIENT : WM_PRINT;
68 WPARAM wParam = reinterpret_cast<WPARAM>(hdc);
69 LPARAM lParam = PRF_CLIENT | PRF_NONCLIENT | PRF_OWNED | PRF_CHILDREN;
70 r = !! ::SendMessage(hWnd, message, wParam, lParam);
71 }
72 return r;
73 }
74};
75
76
77
78};//TNB
動的関数管理関係のヘッダ
動的関数管理クラステンプレート
NULLポインタ例外
Definition: TnbException.h:172
void OnCatch(void) const
[表示] 内容表示
Definition: TnbException.h:69
ウィンドウズ表示管理
CWindowPrinter(void)
コンストラクタ
bool PrintWindow(HWND hWnd, HDC hdc, bool isClientOnly=true)
[描画] ウィンドウ描画.
TNB Library
Definition: TnbDoxyTitle.txt:2