www.pudn.com > CapIT_src.zip > CapITView.h


// CapITView.h : interface of the CCapITView class 
// 
///////////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_CAPITVIEW_H__8B113E12_CDDB_414F_B9B9_B035CE18283C__INCLUDED_) 
#define AFX_CAPITVIEW_H__8B113E12_CDDB_414F_B9B9_B035CE18283C__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
 
#define PW_WINDOW        1  
#define PW_CLIENT        2  
 
#define RECTWIDTH(lpRect)     ((lpRect)->right - (lpRect)->left)  
#define RECTHEIGHT(lpRect)    ((lpRect)->bottom - (lpRect)->top)  
 
 
class CCapITView : public CScrollView 
{ 
protected: // create from serialization only 
	CCapITView(); 
	DECLARE_DYNCREATE(CCapITView) 
 
// Attributes 
public: 
	CCapITDoc* GetDocument(); 
 
	BOOL gbIsCaptured; 
	BOOL gbDrawImage; 
 
	CWnd* oldCap; 
	HCURSOR m_hcurOld; 
 
	HBITMAP     ghBitmap; 
	HPALETTE    ghPal; 
	BOOL        gbNewRect; 
	CPoint      gpStartPoint; 
	CPoint      gpEndPoint; 
	CRect       grCapRect; 
 
	CRect       grRcPrev; 
	BOOL        gbIsMarking; 
	BOOL       	gbCaptureMode; 
 
	CWnd*       gCaptureWnd; 
 
	BOOL        m_bHookSetup; 
 
	CWnd*       gMainWnd; 
 
// Operations 
public: 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CCapITView) 
	public: 
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view 
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 
	protected: 
	virtual void OnInitialUpdate(); // called first time after construct 
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); 
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); 
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); 
	//}}AFX_VIRTUAL 
 
// Implementation 
public: 
	void CaptureDesktop(); 
	void ClearCapture(); 
	void CaptureClient(); 
	void CaptureControl(); 
	void CaptureWindow(); 
	void UpdateCaptureStatus(BOOL bCaptured); 
	 
	void SetupHookProc(); 
    static void UpdateStatusbar(COLORREF cr, BOOL bShowCodes , BOOL bShowPosition); 
	void CaptureClientArea(CWnd* wnd); 
	void WindowCapture(HWND wnd); 
	virtual ~CCapITView(); 
#ifdef _DEBUG 
	virtual void AssertValid() const; 
	virtual void Dump(CDumpContext& dc) const; 
#endif 
 
protected: 
	int PalEntriesOnDevice(HDC hDC); 
	HDIB ChangeBitmapFormat(HBITMAP hBitmap, WORD wBitCount, DWORD dwCompression, HPALETTE hPal, HWND hwnd); 
	HANDLE AllocRoomForDIB(BITMAPINFOHEADER bi, HBITMAP hBitmap , HWND hwnd); 
	HPALETTE GetSystemPalette(HWND hwnd); 
	WORD PaletteSize (VOID FAR * pv); 
	WORD DibNumColors (VOID FAR * pv); 
 
	WORD SaveDIB(HDIB hDib, LPSTR lpFileName); 
	void ReallyGetClientRect(CWnd* wnd , LPRECT lpRect); 
	void SetupScrollBars(CWnd* wnd , WORD cxBitmap, WORD cyBitmap); 
	void DoSize(CWnd* wnd , HBITMAP ghBitmap); 
	BOOL PaintBitmap(HDC hDC, LPRECT lpDCRect, HBITMAP hDDB ,  LPRECT lpDDBRect, HPALETTE hPal); 
	HBITMAP CopyScreenToBitmap(LPRECT lpRect); 
	HBITMAP CopyWindowToBitmap(CWnd* wnd , HWND hWnd, WORD fPrintArea ); 
 
 
// Generated message map functions 
protected: 
	//{{AFX_MSG(CCapITView) 
	afx_msg void OnCaptureChanged(CWnd *pWnd); 
	afx_msg void OnDestroy(); 
	afx_msg void OnSaveFile(); 
	afx_msg void OnUpdateSaveFile(CCmdUI* pCmdUI); 
	afx_msg void OnColorcode(); 
	afx_msg void OnUpdateColorcode(CCmdUI* pCmdUI); 
	afx_msg void OnTrackpos(); 
	afx_msg void OnUpdateTrackpos(CCmdUI* pCmdUI); 
 
	afx_msg void OnClear(); 
	afx_msg void OnUpdateClear(CCmdUI* pCmdUI); 
 
	afx_msg void OnHideWindow(); 
	 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
#ifndef _DEBUG  // debug version in CapITView.cpp 
inline CCapITDoc* CCapITView::GetDocument() 
   { return (CCapITDoc*)m_pDocument; } 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_CAPITVIEW_H__8B113E12_CDDB_414F_B9B9_B035CE18283C__INCLUDED_)