error C2276: “&”: 绑定成员函数表达式上的非法操作

来源:互联网 发布:常见软件项目风险 编辑:程序博客网 时间:2024/06/05 11:13

// CSMSPClientDlg.h : 头文件
//

#pragma once
#include "afxwin.h"


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

// 对话框数据
 enum { IDD = IDD_CSMSPCLIENT_DIALOG };

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

 bool CreateSocket();
 bool Connect();
 bool Bind();
 bool SendContent();
 bool RecvContent();
 static DWORD ThreadProc(LPVOID lpdwThreadParam);
 
// 实现
protected:
 HICON m_hIcon;

 // 生成的消息映射函数
 virtual BOOL OnInitDialog();
 afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
 afx_msg void OnPaint();
 afx_msg HCURSOR OnQueryDragIcon();
 DECLARE_MESSAGE_MAP()
public:
 CButton m_btnSendCtrl;
 CString m_strComboType;
 CString m_strPort;
 DWORD m_dwServerAddr;
 DWORD dwThreadId;
 CString m_strRecv;
 CString m_strSend;
 SOCKET  m_handle;
 sockaddr_in m_recvAddr;
 afx_msg void OnBnClickedButtonSend();
 CComboBox m_combTypeCtrl;
};

引用的地方:

if (CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)&ThreadProc,(LPVOID)&i,0,&dwThreadId) == NULL)

结果总是出现上面提示错误,最后加了一个static后,编译通过!

原创粉丝点击