ClientDlg.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // ClientDlg.h : header file
  2. //
  3. #pragma once
  4. #include "afxwin.h"
  5. #include "../../../Src/HPSocket.h"
  6. #include "../../Global/helper.h"
  7. // CClientDlg dialog
  8. class CClientDlg : public CDialogEx, public CTcpClientListener
  9. {
  10. // Construction
  11. public:
  12. CClientDlg(CWnd* pParent = NULL); // standard constructor
  13. // Dialog Data
  14. enum { IDD = IDD_CLIENT_DIALOG };
  15. protected:
  16. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  17. virtual BOOL PreTranslateMessage(MSG* pMsg);
  18. // Implementation
  19. protected:
  20. HICON m_hIcon;
  21. // Generated message map functions
  22. virtual BOOL OnInitDialog();
  23. afx_msg void OnPaint();
  24. afx_msg HCURSOR OnQueryDragIcon();
  25. afx_msg void OnBnClickedSend();
  26. afx_msg void OnBnClickedStart();
  27. afx_msg void OnBnClickedStop();
  28. afx_msg LRESULT OnUserInfoMsg(WPARAM wp, LPARAM lp);
  29. afx_msg int OnVKeyToItem(UINT nKey, CListBox* pListBox, UINT nIndex);
  30. DECLARE_MESSAGE_MAP()
  31. public:
  32. void SetAppState(EnAppState state);
  33. private:
  34. virtual EnHandleResult OnSend(IClient* pClient, const BYTE* pData, int iLength);
  35. virtual EnHandleResult OnReceive(IClient* pClient, const BYTE* pData, int iLength);
  36. virtual EnHandleResult OnClose(IClient* pClient, EnSocketOperation enOperation, int iErrorCode);
  37. virtual EnHandleResult OnConnect(IClient* pClient);
  38. private:
  39. CEdit m_Content;
  40. CButton m_Send;
  41. CListBox m_Info;
  42. CEdit m_Address;
  43. CEdit m_Port;
  44. CButton m_Async;
  45. CButton m_Start;
  46. CButton m_Stop;
  47. EnAppState m_enState;
  48. BOOL m_bAsyncConn;
  49. CTcpPackClientPtr m_Client;
  50. };