// RealPlayDlg.h : header file
//

#if !defined(AFX_REALPLAYDLG_H__B4B6BD6F_C92D_4448_B4E2_98DCA61A490D__INCLUDED_)
#define AFX_REALPLAYDLG_H__B4B6BD6F_C92D_4448_B4E2_98DCA61A490D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <list>
#include "dhnetsdk.h"
/////////////////////////////////////////////////////////////////////////////
// CRealPlayDlg dialog

typedef struct
{
	int           nThreadIndex;
	DWORD         dwUserInfo;          
}Thread_Info;

//	channel information
typedef struct 
{
	LLONG			lRealPlayHandle;
	unsigned long		dwStatistic;
} Channel_Info;

//	device information
typedef struct 
{
	LLONG			lLoginHandle;
	int			    nChannelCount;
	int			    bOnline;
	char			szDevIp[32];
	int				nPort;
	char			szUserName[32];
	char			szPassWord[32];
	Channel_Info	channel[16];
	int				nBelongThread;
	unsigned int	nIndex;	
	unsigned long	nTimeCount;//¼ÆÊ±Æ÷
} Device_Info;

class CRealPlayDlg : public CDialog
{
// Construction
public:
	CRealPlayDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CRealPlayDlg)
	enum { IDD = IDD_REALPLAY_DIALOG };
	CListCtrl	m_ctlDevInfo;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRealPlayDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CRealPlayDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnButtonLoadconfig();
	afx_msg void OnButtonPlay();
	afx_msg void OnButtonStop();
	afx_msg void OnButtonStopall();
//#ifdef WIN64
	afx_msg void OnTimer(UINT_PTR nIDEvent);
//#else ifdef WIN32
//	afx_msg void OnTimer(UINT nIDEvent);
//#endif
	afx_msg void OnClickListDevinfo(NMHDR* pNMHDR, LRESULT* pResult);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

public:
	void LogDevs(int nThreadId);
	void ShowDevsInfo();
	void OnDisConnect(LONG lLoginID, char *pchDVRIP, LONG nDVRPort);
	static void  __stdcall RoutineLoginThread(void* lParam);

private:
	DWORD GetPrivateProfileString(LPCTSTR lpAppName, LPCTSTR lpKeyName, 
		LPCTSTR lpDefault, LPTSTR lpReturnedString,  DWORD nSize,
		LPCTSTR lpFileName);
	BOOL ReadConfigFile();

private:
	std::list<Device_Info*> m_lsDeviceInfo;
	CRITICAL_SECTION m_csDeviceInfo;
	int m_nThreadNum;
	int m_nTimerId;
	int m_nSeletItem;


};

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

#endif // !defined(AFX_REALPLAYDLG_H__B4B6BD6F_C92D_4448_B4E2_98DCA61A490D__INCLUDED_)
