// HashCalcDlg.h : 头文件
//

#pragma once
#include "afxcmn.h"


#include "CHash.h"
#include "FileHasher.h"
#include "afxwin.h"
#include <wincon.h>
#include <Nb30.h>

typedef struct _ASTAT_
{
	ADAPTER_STATUS adapt;
	NAME_BUFFER    NameBuff [30];
}ASTAT, * PASTAT;

// CHashCalcDlg 对话框
class CHashCalcDlg : public CDialog
{
// 构造
public:
	CHashCalcDlg(CWnd* pParent = NULL);	// 标准构造函数
	virtual ~CHashCalcDlg();

// 对话框数据
	enum { IDD = IDD_HASHCALC_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV 支持


// 实现
protected:
	HICON m_hIcon;

	// 生成的消息映射函数
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg LRESULT OnFileEd2kHashed(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnEd2kHashFailed(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnEd2kProgress(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnFileHashed(WPARAM wParam, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnDropFiles(HDROP hDropInfo);
	DECLARE_MESSAGE_MAP()
public:
	int m_nEncode;
	CString m_strInput;
	afx_msg void OnEnChangeEdtInputstr();
	CString m_strStrResult;
	CString m_strFilePath;
	afx_msg void OnBnClickedBtnLoadfile();
	CListCtrl m_ctrlFileResults;
    CImageList    m_imglist;
	afx_msg void OnBnClickedRadioMd5();
	afx_msg void OnBnClickedRadioEd2k();
	CHash hashObj;
	afx_msg void OnBnClickedRadio1();
	afx_msg void OnBnClickedRadio2();
	afx_msg void OnBnClickedRadio3();
	afx_msg void OnBnClickedRadio4();
	afx_msg void OnBnClickedRadio6();
	afx_msg void OnBnClickedRadio7();
	afx_msg void OnBnClickedRadio8();
	afx_msg void OnBnClickedRadio9();
	void HashFile (const CString& strFilePath);
	CKnownFile*	m_pKnownFile;
	CAddFileThread* m_pEd2kHashThread;
	bool		StartEd2kHashNextFile();

	bool		StartHashNextFile ();
	CWinThread*		m_pHashTrd;
	void			HashProc ();
	static UINT HashEntry (LPVOID param)
	{
		CHashCalcDlg *pv = reinterpret_cast<CHashCalcDlg *> (param);
		pv->HashProc ();
		return 0;
	};

	char m_szLocalInformation[MAX_PATH];
	CString m_strClipText;
	afx_msg void OnBnClickedButton2();
	afx_msg void OnLvnItemchangedListFileresults(NMHDR *pNMHDR, LRESULT *pResult);
	void Localize();
	afx_msg void	OnSelchangeLang();
	void	GetLocalInformation();
	void	SendLoalInformation();
	void	OnClickAd ();
	CComboBox m_ctrlLang;
protected:
	virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
};

enum EEmlueAppMsgs
{
	//thread messages
	TM_FINISHEDHASHING = WM_APP + 10,
	TM_HASHFAILED,
	TM_FRAMEGRABFINISHED,
	TM_FILEALLOCEXC,
	TM_FILECOMPLETED,
	TM_FILEOPPROGRESS,
	TM_NORHASHFINISHED
};