ServerDlg.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // ServerDlg.h : header file
  2. //
  3. #pragma once
  4. #include "afxwin.h"
  5. #include "../../../Src/HPSocket4C.h"
  6. #include "../../Global/helper.h"
  7. // CServerDlg dialog
  8. class CServerDlg : public CDialogEx
  9. {
  10. // Construction
  11. public:
  12. CServerDlg(CWnd* pParent = NULL); // standard constructor
  13. ~CServerDlg(); // standard destructor
  14. // Dialog Data
  15. enum { IDD = IDD_SERVER_DIALOG };
  16. protected:
  17. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  18. virtual BOOL PreTranslateMessage(MSG* pMsg);
  19. // Implementation
  20. protected:
  21. HICON m_hIcon;
  22. // Generated message map functions
  23. virtual BOOL OnInitDialog();
  24. afx_msg void OnPaint();
  25. afx_msg HCURSOR OnQueryDragIcon();
  26. afx_msg void OnBnClickedStart();
  27. afx_msg void OnBnClickedStop();
  28. afx_msg LRESULT CServerDlg::OnUserInfoMsg(WPARAM wp, LPARAM lp);
  29. afx_msg int OnVKeyToItem(UINT nKey, CListBox* pListBox, UINT nIndex);
  30. afx_msg void OnBnClickedDisconnect();
  31. afx_msg void OnEnChangeHP_CONNID();
  32. DECLARE_MESSAGE_MAP()
  33. public:
  34. void SetAppState(EnAppState state);
  35. private:
  36. static En_HP_HandleResult __stdcall OnPrepareListen(SOCKET soListen);
  37. static En_HP_HandleResult __stdcall OnAccept(HP_CONNID dwHP_CONNID, SOCKET soClient);
  38. static En_HP_HandleResult __stdcall OnSend(HP_CONNID dwHP_CONNID, const BYTE* pData, int iLength);
  39. static En_HP_HandleResult __stdcall OnReceive(HP_CONNID dwHP_CONNID, int iLength);
  40. static En_HP_HandleResult __stdcall OnClose(HP_CONNID dwHP_CONNID, En_HP_SocketOperation enOperation, int iErrorCode);
  41. static En_HP_HandleResult __stdcall OnShutdown();
  42. private:
  43. TPkgInfo* FindPkgInfo(HP_CONNID dwHP_CONNID);
  44. void RemovePkgInfo(HP_CONNID dwHP_CONNID);
  45. private:
  46. CListBox m_Info;
  47. CButton m_Start;
  48. CButton m_Stop;
  49. CEdit m_Address;
  50. CEdit m_HP_CONNID;
  51. CButton m_DisConn;
  52. private:
  53. EnAppState m_enState;
  54. CString m_strAddress;
  55. //CCriSec m_csPkgInfo;
  56. private:
  57. static const USHORT PORT;
  58. static const LPCTSTR ADDRESS;
  59. static CServerDlg* m_spThis;
  60. HP_TcpPullServer m_pServer;
  61. HP_TcpPullServerListener m_pListener;
  62. };