#if !defined(AFX_NETPLAYXCTL_H__35B22EA8_2370_471A_8080_2084D9D817CE__INCLUDED_)
#define AFX_NETPLAYXCTL_H__35B22EA8_2370_471A_8080_2084D9D817CE__INCLUDED_

#include "DlgFull.h"	// Added by ClassView
#include "DlgDownload.h"	// Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// NetPlayXCtl.h : Declaration of the CNetPlayXCtrl ActiveX Control class.
#include "NetPlayButtonID.h"
#include "MyFourButton.h"
#include "StaticVideoWnd.h"
#include "ColorStatic.h"
#include "MySliderCtrl.h"
#ifdef L_IMPL_OBJECTSAFETY
#include <objsafe.h>
#endif // L_IMPL_OBJECTSAFETY

/////////////////////////////////////////////////////////////////////////////
// CNetPlayXCtrl : See NetPlayXCtl.cpp for implementation.
typedef struct
{
    int         fastslow;
    BOOL        turn;
    BOOL        full;
}PLAYINFO;

class CNetPlayXCtrl : public COleControl
{
	DECLARE_DYNCREATE(CNetPlayXCtrl)

// Constructor
public:
	CNetPlayXCtrl();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CNetPlayXCtrl)
	public:
	virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
	virtual void DoPropExchange(CPropExchange* pPX);
	virtual void OnResetState();
	//}}AFX_VIRTUAL

#ifdef L_IMPL_OBJECTSAFETY 
	BEGIN_INTERFACE_PART(ObjectSafety, IObjectSafety) 
		STDMETHOD(GetInterfaceSafetyOptions)(REFIID riid, DWORD __RPC_FAR *pdwSupportedOptions, DWORD __RPC_FAR *pdwEnabledOptions); 
		STDMETHOD(SetInterfaceSafetyOptions)(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions); 
	END_INTERFACE_PART(ObjectSafety) 

	DECLARE_INTERFACE_MAP(); 
#endif // L_IMPL_OBJECTSAFET

// Implementation
protected:
	~CNetPlayXCtrl();

	DECLARE_OLECREATE_EX(CNetPlayXCtrl)    // Class factory and guid
	DECLARE_OLETYPELIB(CNetPlayXCtrl)      // GetTypeInfo
	DECLARE_PROPPAGEIDS(CNetPlayXCtrl)     // Property page IDs
	DECLARE_OLECTLTYPE(CNetPlayXCtrl)		// Type name and misc status

// Message maps
	//{{AFX_MSG(CNetPlayXCtrl)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnDestroy();
	afx_msg void OnPlayEvent(WPARAM wParam, LPARAM lParam);
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

// Dispatch maps
	//{{AFX_DISPATCH(CNetPlayXCtrl)
	CString m_password;
	afx_msg void OnPasswordChanged();
	CString m_url;
	afx_msg void OnUrlChanged();
	CString m_username;
	afx_msg void OnUsernameChanged();
	short m_wServerPort;
	afx_msg void OnWServerPortChanged();
	short m_islocalfile;
	afx_msg void OnIslocalfileChanged();
	afx_msg void NetFileDownload(LPCTSTR RemoteFile, LPCTSTR SaveFile, BOOL convertASF);
	afx_msg void NetFileFindStart(LPCTSTR sername, short channel, BOOL bDateLimite, short year_start, short month_start, short day_start, short hour_start, short minute_start, short year_end, short month_end, short day_end, short hour_end, short minute_end, long filetype, long recvtype);
	afx_msg void NetFileFindStop();
	afx_msg void NetFileStopDownload();
	afx_msg void NetStartPlay(LPCTSTR filename,const VARIANT FAR& filecreatetime);
	afx_msg short GetFindFileNum();
	afx_msg short ReadFindFile(short beginnumber, short number);
	afx_msg void SetNetStayTime(short staytime);
	afx_msg BSTR GetSaveFileName(LPCTSTR serName, LPCTSTR Remotefile, short isAsf);
	afx_msg BSTR GetSaveDirectory();
	afx_msg BSTR GetSaveFileNameEx(LPCTSTR serName, LPCTSTR Remotefile, short isAsf);
	afx_msg void JumpAt(LPCTSTR lpTime);
	afx_msg void BtnPlay();
	afx_msg void BtnPause();
	afx_msg void BtnStop();
	afx_msg void BtnStep();
	afx_msg void BtnFast();
	afx_msg void BtnSlow();
	afx_msg void BtnTurn();
	afx_msg void BtnAudio(short state);
	afx_msg void ShowBtns(BOOL bshow);
	afx_msg void NetSchSetDiskType(short disktype);
	//}}AFX_DISPATCH
	DECLARE_DISPATCH_MAP()

	afx_msg void AboutBox();

// Event maps
	//{{AFX_EVENT(CNetPlayXCtrl)
	void FireNetFileDownloadEvent(long proval)
		{FireEvent(eventidNetFileDownloadEvent,EVENT_PARAM(VTS_I4), proval);}
	void FireNetFileFindEvent(long proval)
		{FireEvent(eventidNetFileFindEvent,EVENT_PARAM(VTS_I4), proval);}
	void FirePlayBackEvent(long retval)
		{FireEvent(eventidPlayBackEvent,EVENT_PARAM(VTS_I4), retval);}
	void FirePlayBackPosEvent(long playpos)
		{FireEvent(eventidPlayBackPosEvent,EVENT_PARAM(VTS_I4), playpos);}
	void FirePlayBufferPosEvent(long bufferPos)
		{FireEvent(eventidPlayBufferPosEvent,EVENT_PARAM(VTS_I4), bufferPos);}
	void FireSearchFileNotify(LPCTSTR sername, short ch, LPCTSTR filetime, LPCTSTR filename, long filesize)
		{FireEvent(eventidSearchFileNotify,EVENT_PARAM(VTS_BSTR  VTS_I2  VTS_BSTR  VTS_BSTR  VTS_I4), sername, ch, filetime, filename, filesize);}
	void FireClickSel()
		{FireEvent(eventidClickSel,EVENT_PARAM(VTS_NONE));}
	void FireLButtonDblClk()
		{FireEvent(eventidLButtonDblClk,EVENT_PARAM(VTS_NONE));}
	//}}AFX_EVENT
	DECLARE_EVENT_MAP()

// Dispatch and event IDs
private:
	CMyFourButton	*m_ButtonPlay,*m_ButtonPause,*m_ButtonStop;
	CMyFourButton	*m_ButtonStep,*m_ButtonFast,*m_ButtonSlow;
	CMyFourButton	*m_ButtonAudio,*m_ButtonFull,*m_ButtonDownload,*m_ButtonGo;
	CStaticVideoWnd	*m_videownd;
	CMySliderCtrl   *m_sliderpos;
	CMySliderCtrl   *m_slideraudio;
	CColorStatic    *m_statusplay;
	CColorStatic    *m_statuspos;
	CMyFourButton	*m_ButtonCut,*m_ButtonSave;
	CMyFourButton	*m_ButtonSharppen;

	////////////////////////////////////////
	CMyFourButton	*m_ButtonTurn;

	CFont   m_font;
public:
    void MyBtnEvent(UINT ID, UINT MouesEven, UINT nFlag);
public:
	enum {
	//{{AFX_DISP_ID(CNetPlayXCtrl)
	dispidPassword = 1L,
	dispidUrl = 2L,
	dispidUsername = 3L,
	dispidWServerPort = 4L,
	dispidIslocalfile = 5L,
	dispidNetFileDownload = 6L,
	dispidNetFileFindStop = 8L,
	dispidNetFileStopDownload = 9L,
	dispidNetStartPlay = 10L,
	dispidGetFindFileNum = 11L,
	dispidReadFindFile = 12L,
	dispidNetFileFindStart = 7L,
	dispidSetNetStayTime = 13L,
	dispidGetSaveFileName = 14L,
	dispidGetSaveDirectory = 15L,
	dispidGetSaveFileNameEx = 16L,
	dispidJumpAt = 17L,
	dispidBtnPlay = 18L,
	dispidBtnPause = 19L,
	dispidBtnStop = 20L,
	dispidBtnStep = 21L,
	dispidBtnFast = 22L,
	dispidBtnSlow = 23L,
	dispidBtnTurn = 24L,
	dispidBtnAudio = 25L,
	dispidShowBtns = 26L,
	dispidNetSchSetDiskType = 27L,
	eventidNetFileDownloadEvent = 1L,
	eventidNetFileFindEvent = 2L,
	eventidPlayBackEvent = 3L,
	eventidPlayBackPosEvent = 4L,
	eventidPlayBufferPosEvent = 5L,
	eventidSearchFileNotify = 6L,
	eventidVv = 7L,
	eventidBB = 8L,
	eventidClickSel = 9L,
	eventidLButtonDblClk = 10L,
	//}}AFX_DISP_ID
	};

private:
	UINT m_convTimer;				//文件转换定时器
	LONG m_hConvHandle;				//文件转换句柄
	UINT m_downTimer;				//下载定时器
	LONG m_hDownHandle;             //下载句柄
	UINT m_searchTimer;             //查找定时器
	LONG m_hFindHandle;             //查找句柄
	UINT m_playstaytimer;           //缓冲定时器
	UINT m_playTimer;				//播放定时器
	DWORD m_filetime;               //文件播放时间
	DWORD m_filecreatetime;			//文件在磁盘创建时间
	BOOL  m_bsliderpos;
	CString m_playfilename;
	DWORD  m_staytime;				//网络播放缓冲时间
	BOOL   m_bdownconvertASF;
	char  m_downtmpfile[MAX_PATH];
	char  m_seavedownfile[MAX_PATH];
	char  m_searchindexfile[MAX_PATH];
	char  m_cutfilename[MAX_PATH];
	BOOL  m_bOnCutFile;
	BOOL	m_bDownloadFile,m_bDownloadStart;//是否正在下载文件
	DWORD	m_downEndTime,m_downStartTime;	//指定时间段下载开始,结束时间
	char	m_szDownloadFile[MAX_PATH];		//下载文件名
public:
	void OnBtnGo();
	void CancelDownload();
	CDlgDownload m_dlgDownload;
	BOOL GetTempFileName(char *lpfilename,int filetype);
	FILE *s_FilePage;                //查找文件放的位置
	LONG s_hPlayHandle;
	int   m_language;
	int   m_netschdisktype;//网络检索文件类型，5：录像盘，6：冗余盘，7：全部
	int m_iSharppenStrength;

private:
    CDlgFull *m_fulldlg;
	BOOL m_isCountTime;
	DWORD m_slidpos;
	PLAYINFO m_playinfo;
	CDWordArray m_filetimes;
	int m_curfilenum;
	int m_filenum;
	CStringArray m_filenames;
	void PlayStart(); 
	void PlayStop();
	void CheckAudio(int state);
	void OnBtnCut();
	void OnBtnSavecut();
	void SortFindResult();
	void OnBtnDownload();
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_NETPLAYXCTL_H__35B22EA8_2370_471A_8080_2084D9D817CE__INCLUDED)





















