HP-Socket/Windows/Demo/TestEcho-UDP/Client/ClientDlg.h
2021-01-15 15:38:07 +08:00

61 lines
1.6 KiB
C++

// ClientDlg.h : header file
//
#pragma once
#include "afxwin.h"
#include "../../../Src/UdpClient.h"
#include "../../Global/helper.h"
// CClientDlg dialog
class CClientDlg : public CDialogEx, public CUdpClientListener
{
// Construction
public:
CClientDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_CLIENT_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL PreTranslateMessage(MSG* pMsg);
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnEnChangeContent();
afx_msg void OnBnClickedSend();
afx_msg void OnBnClickedStart();
afx_msg void OnBnClickedStop();
afx_msg LRESULT OnUserInfoMsg(WPARAM wp, LPARAM lp);
afx_msg int OnVKeyToItem(UINT nKey, CListBox* pListBox, UINT nIndex);
DECLARE_MESSAGE_MAP()
public:
void SetAppState(EnAppState state);
private:
virtual EnHandleResult OnSend(IUdpClient* pSender, CONNID dwConnID, const BYTE* pData, int iLength);
virtual EnHandleResult OnReceive(IUdpClient* pSender, CONNID dwConnID, const BYTE* pData, int iLength);
virtual EnHandleResult OnClose(IUdpClient* pSender, CONNID dwConnID, EnSocketOperation enOperation, int iErrorCode);
virtual EnHandleResult OnConnect(IUdpClient* pSender, CONNID dwConnID);
private:
CEdit m_Content;
CButton m_Send;
CListBox m_Info;
CEdit m_Address;
CEdit m_Port;
CButton m_Async;
CButton m_Start;
CButton m_Stop;
BOOL m_bAsyncConn;
EnAppState m_enState;
CUdpClient m_Client;
};