// SerialPortWM5Dlg.h : 头文件
//

#pragma once

#include "PSerialPort.h"
#include "resourceppc.h"


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

	BOOL SaveReceivedToFile(LPCTSTR FileName);

	void toTray();

	void SendK(CString sendstr);
	void SendC(CString sendstr);

    //static void Beep (	int frequency, int duration);



		

// 对话框数据
	enum { IDD = IDD_SERIALPORTWM5_DIALOG };
	CEdit	m_CtrlReceive;
	CString	m_strReceive;
	CString	m_strTransmit;
	CComboBox	m_all;
	CComboBox	m_lb;
	CComboBox	m_key;
	CComboBox	m_my;
	CComboBox	m_time;
	CComboBox	m_csk;
	CComboBox	m_ks;
	CComboBox	m_flag;
	NOTIFYICONDATA nid;
	CEdit	m_a1;
	/*CEdit	m_CtrlReceive;
	CEdit	m_CtrlReceive;
	CEdit	m_CtrlReceive;*/

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

// 实现
protected:
	HICON m_hIcon;

	// 生成的消息映射函数
	virtual BOOL OnInitDialog();
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
	afx_msg void OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/);
#endif
	afx_msg void OnSetup();
	afx_msg void OnOpen();
	afx_msg void OnClearRece();
	afx_msg void OnClearSend();
	afx_msg void OnRece();
	afx_msg void OnSend();
	afx_msg void OnDestroy();
	afx_msg void OnCheckHex();
	afx_msg void OnSendFile();
	afx_msg void OnSaveReceived();
	afx_msg void OnCheckHexSend();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg LONG OnDataArrivedMsg(WPARAM wParam,LPARAM lParam);
	afx_msg LONG OnShowTask(WPARAM wParam,LPARAM lParam);
	DECLARE_MESSAGE_MAP()

private:
	//变量
	BOOL Open;
	BOOL Receive;
	BOOL wHide;
	BOOL Enter;
	BOOL read;
	int PortNo,BaudRate,DataBits,StopBits,Parity,readlb,lb,all,my,key,time,csk,ks,flag,Separator;
	CString PortID,PortIDs[9],sd[64];
	int BaudRates[8];
	BOOL HexDisplay,HexSend;
	BOOL ibkey,ibbeep;
	int iizt;
	//串口类变量
	CPSerialPort* m_pSerial;
	
	CString m_strDataReceived,isre;
	static void OnDataArrive(char *data,int length,DWORD userdata);
	afx_msg void OnBnClickedButton1();
	afx_msg void OnBnClickedShow();
	afx_msg void OnEnChangeTransmit();
	afx_msg void OnCbnSelchangeCombo4();
	afx_msg void OnCbnSelchangeCombo1();
	afx_msg void OnCbnSelchangeCombo2();
	afx_msg void OnCbnSelchangeCombo3();
	afx_msg void OnEnChangeEdit1();
	afx_msg void OnBnClickedButton3();
	afx_msg void OnCbnSelchangeCombo5();
	afx_msg void OnCbnSelchangeCombo6();
	afx_msg void OnCbnSelchangeCombo7();
	
	afx_msg void OnEnChangeReceive();
	afx_msg void OnCbnSelchangeCombo8();
	afx_msg void OnBnClickedButton4();
	afx_msg void OnBnClickedKey();
	afx_msg void OnBnClickedBeep();
};
