📄 udpexampledlg.h
字号:
// UDPExampleDlg.h : header file
//
#if !defined(AFX_UDPEXAMPLEDLG_H__E51D7457_3C8C_446F_B776_25B35554B59F__INCLUDED_)
#define AFX_UDPEXAMPLEDLG_H__E51D7457_3C8C_446F_B776_25B35554B59F__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "winsock.h"
/////////////////////////////////////////////////////////////////////////////
// CUDPExampleDlg dialog
class CUDPExampleDlg : public CDialog
{
// Construction
public:
CUDPExampleDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CUDPExampleDlg)
enum { IDD = IDD_UDPEXAMPLE_DIALOG };
CButton m_ButCloseSocket;
CButton m_ButOpenSocket;
CString m_RemoteHost;
int m_RemotePort;
CString m_SendStr;
int m_LocalPort;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CUDPExampleDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CUDPExampleDlg)
virtual BOOL OnInitDialog();
afx_msg void OnOpen();
afx_msg void OnCloseSocket();
afx_msg void OnSend();
afx_msg void OnClearRecdisp();
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
SOCKET m_UDPSocket; /* 本地UDP Socket */
SOCKADDR_IN m_RemoteAddr; /* 远程主机地址 */
CString m_strRecDisp; /* 接收区显示字符 */
HANDLE m_ExitThreadEvent; /* UDP 接收线程退出事件 */
static DWORD UdpRecvTread(LPVOID lparam); /* UDP 接收线程函数 */
// UDP 接收成功和接收错误回调函数
typedef void (CALLBACK *ONUDPRECV)(CWnd* pWnd, char *buf, int buflen);
typedef void (CALLBACK *ONUDPERROR)(CWnd *pWnd, int iErrorCode);
static void CALLBACK OnUdpRecv(CWnd* pWnd, char *buf, int buflen);
static void CALLBACK OnUdpError(CWnd *pWnd, int iErrorCode);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_UDPEXAMPLEDLG_H__E51D7457_3C8C_446F_B776_25B35554B59F__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -