用vs2010mfc做arp报文发送,但是mfc好像出了问题

#include "stdafx.h"
#include "occimpl.h"

#define new DEBUG_NEW

/////////////////////////////////////////////////////////////////////////////
// CCmdTarget construction/destruction

CCmdTarget::CCmdTarget()
{
// capture module state where object was constructed
m_pModuleState = AfxGetModuleState();
ASSERT(m_pModuleState != NULL);

// initialize state

#ifndef _AFX_NO_OLE_SUPPORT
m_dwRef = 1;
m_pOuterUnknown = NULL;
m_xInnerUnknown = 0;
m_xDispatch.m_vtbl = 0;
m_bResultExpected = TRUE;
m_xConnPtContainer.m_vtbl = 0;
#endif
}

CCmdTarget::~CCmdTarget()
{
#ifndef _AFX_NO_OLE_SUPPORT
if (m_xDispatch.m_vtbl != 0)
((COleDispatchImpl*)&m_xDispatch)->Disconnect();
ASSERT(m_dwRef <= 1);
#endif
m_pModuleState = NULL;
}

/////////////////////////////////////////////////////////////////////////////
// CCmdTarget windows message dispatching

AFX_STATIC BOOL AFXAPI _AfxDispatchCmdMsg(CCmdTarget* pTarget, UINT nID, int nCode,
AFX_PMSG pfn, void* pExtra, UINT_PTR nSig, AFX_CMDHANDLERINFO* pHandlerInfo)
// return TRUE to stop routing
{
ENSURE_VALID(pTarget);
UNUSED(nCode); // unused in release builds

union MessageMapFunctions mmf;
mmf.pfn = pfn;
BOOL bResult = TRUE; // default is ok

if (pHandlerInfo != NULL)
{
    // just fill in the information, don't do it
    pHandlerInfo->pTarget = pTarget;
    pHandlerInfo->pmf = mmf.pfn;
    return TRUE;
}

switch (nSig)
{
default:    // illegal
    ASSERT(FALSE);
    return 0;
    break;

_**_case AfxSigCmd_v:
    // normal command or control notification
    ASSERT(CN_COMMAND == 0);        // CN_COMMAND same as BN_CLICKED
    ASSERT(pExtra == NULL);
    (pTarget->*mmf.pfnCmd_v_v)();
    break;_

_**(这一块运行时说是)
case AfxSigCmd_b:
// normal command or control notification
ASSERT(CN_COMMAND == 0); // CN_COMMAND same as BN_CLICKED
ASSERT(pExtra == NULL);
bResult = (pTarget->*mmf.pfnCmd_b_v)();
break;

case AfxSigCmd_RANGE:
    // normal command or control notification in a range
    ASSERT(CN_COMMAND == 0);        // CN_COMMAND same as BN_CLICKED
    ASSERT(pExtra == NULL);
    (pTarget->*mmf.pfnCmd_v_u)(nID);
    break;

case AfxSigCmd_EX:
    // extended command (passed ID, returns bContinue)
    ASSERT(pExtra == NULL);
    bResult = (pTarget->*mmf.pfnCmd_b_u)(nID);
    break;

case AfxSigNotify_v:
    {
        AFX_NOTIFY* pNotify = (AFX_NOTIFY*)pExtra;
        ENSURE(pNotify != NULL);
        ASSERT(pNotify->pResult != NULL);
        ASSERT(pNotify->pNMHDR != NULL);
        (pTarget->*mmf.pfnNotify_v_NMHDR_pl)(pNotify->pNMHDR, pNotify->pResult);
    }
    break;

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问