www.pudn.com > ViewerCarry.rar > ThumbViewerView.h


// ThumbViewerView.h : interface of the CThumbViewerView class 
// 
///////////////////////////////////////////////////////////////////////////// 
#if !defined(AFX_THUMBVIEWERVIEW_H__CA5ED4AC_832E_4B39_B538_0E76AAC95ED9__INCLUDED_) 
#define AFX_THUMBVIEWERVIEW_H__CA5ED4AC_832E_4B39_B538_0E76AAC95ED9__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
#include   
#include  "BaseDef.h" 
#include  "DisplayTranProgDlg.h" 
#include  "PhookImageOp.h" 
#include  "SocketSession.h" 
 
#define	THUMBNAIL_WIDTH		    100 
#define	THUMBNAIL_HEIGHT	    90 
#define THUMBNAIL_WIDTH_MASK	25 
#define THUMBNAIL_HEIGHT_MASK	25 
// 
 
using namespace std; 
 
class CThumbViewerView; 
class CThumbViewerDoc; 
class CUpdateDlg; 
//传输线程消息,这个消息需要传递到文件传输线程 
typedef struct tag_UPDATETHREADMSG 
{ 
   CString sImagePath; 
   int     nThreadNo; 
}UPDATETHREADMSG,*P_UPDATETHREADMSG; 
 
class CThumbViewerView : public CListView 
{ 
protected: // create from serialization only 
	CThumbViewerView(); 
	DECLARE_DYNCREATE(CThumbViewerView) 
// Attributes 
public: 
	bool IsRunning() { return m_bLoadThumbNailRunning;} 
	CThumbViewerDoc* GetDocument(); 
// Operations 
public: 
   CRect m_Rect; 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CThumbViewerView) 
	public: 
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view 
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); 
	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 CancelRemoveSelectItem(int nIndex); 
	CListCtrl m_ListCtrl; 
	void    RemoveSelectItem(int nIndex); 
	int     m_nSelectItem; 
	int     GetResumeImageIndex(); 
	int     GetRemoveImageIndex(); 
    void ClearCompArray(); 
	int m_nRemoveArray[MAX_ARRAY_NUM]; 
	int m_nRemove; 
	int m_nCacelRemoveArray[MAX_ARRAY_NUM]; 
    int m_nCacelRemove; 
	int m_nResumeImage; 
	int m_nRemoveImage; 
 
	BOOL    TerminateLoadThumbNailThread(); 
	BOOL    TerminateUpdateFileThread(); 
	BOOL    TerminateResumeImageThread(); 
	BOOL    TerminateRemoveImageThread(); 
    
	void    LoadThumbImages(); 
	virtual ~CThumbViewerView(); 
#ifdef _DEBUG 
	virtual void AssertValid() const; 
	virtual void Dump(CDumpContext& dc) const; 
#endif 
 
protected: 
	bool m_bLoadThumbNailRunning;			// Flag to whether thread is on running or not 
	bool m_bLoadThumbNailTerminate;			// Flag to Thread to be terminated 
	 
	bool m_bUpdateFileRunning;  //上传线程正在运行的标志 
	bool m_bUpdateFileThread;//上传线程终止标志 
     
	bool m_bResumeImageRuning; 
	bool m_bResumeImageThread;//恢复线程标志 
	 
	bool m_bRemoveImageRuning; 
	bool m_bRemoveImageThread;//移除图片线程标志 
 
	unsigned int m_dwLoadThumbNailThreadID,m_dwUpdateFileThreadID,m_dwResumeImageThreadID,m_dwRemoveImageThreadID;	// Thread ID 
	HANDLE m_hLoadThumbNailThread, m_hLoadThumbNailEvent,m_hUpdateFileThread,m_hResumeImageThread,m_hRemoveImageThread; // Thread and Event handle 
 
	static unsigned __stdcall	LoadThumbNailThread(LPVOID lpParam); 
	static unsigned __stdcall   UpdateFileToServerThread(LPVOID lpParam); 
	static unsigned __stdcall   ResumeSelectImageThread(LPVOID lpParam); 
	static unsigned __stdcall   RemoveSelectImageThread(LPVOID lpParam); 
 
	CImageList	m_ImageListThumb;		// image list holding the thumbnails 
// Generated message map functions 
protected: 
	//{{AFX_MSG(CThumbViewerView) 
	afx_msg void OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult); 
	afx_msg BOOL OnEraseBkgnd(CDC* pDC); 
	afx_msg void OnImageRemove(); 
	afx_msg void OnImageWithdraw(); 
	afx_msg void OnFileUpdate(); 
	afx_msg void OnUpdateFileGray(CCmdUI* pCmdUI); 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
#ifndef _DEBUG  // debug version in ThumbViewerView.cpp 
inline CThumbViewerDoc* CThumbViewerView::GetDocument() 
   { return (CThumbViewerDoc*)m_pDocument; } 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_THUMBVIEWERVIEW_H__CA5ED4AC_832E_4B39_B538_0E76AAC95ED9__INCLUDED_)