想问一下error C2440: "类型转换": 无法从"overloaded-function"转换为"HOOKPROC"是咋回事
voidCMFCApplication2Dlg::OnBnClickedButton3(){hHook=SetWindowsHookEx(WH_JOURNALRECORD...
void CMFCApplication2Dlg::OnBnClickedButton3()
{
hHook =SetWindowsHookEx(
WH_JOURNALRECORD,
(HOOKPROC)JournalRecordProc,
AfxGetApp()->m_hInstance,
0
);
// TODO: 在此添加控件通知处理程序代码
}
LRESULT CALLBACK JournalRecordProc(int nCode,WPARAM wparam,LPARAM lparam)
{
if (nCode<0)
return CallNextHookEx(NULL,nCode,wparam,lparam);
EVENTMSG*pmsg=(EVENTMSG*)lparam;
switch(nCode)
{
case HC_ACTION:
{EVENTMSG * pEventMsg =new EVENTMSG;
memcpy(pEventMsg,pmsg,sizeof(EVENTMSG));
EventMsgList.AddTail(pEventMsg);}
break;
case HC_SYSMODALOFF:
break;
case HC_SYSMODALON:
break;
}
}
1>e:\pjb\mfcapplication2\mfcapplication2\mfcapplication2dlg.cpp(194): error C2440: “类型转换”: 无法从“overloaded-function”转换为“HOOKPROC” 展开
{
hHook =SetWindowsHookEx(
WH_JOURNALRECORD,
(HOOKPROC)JournalRecordProc,
AfxGetApp()->m_hInstance,
0
);
// TODO: 在此添加控件通知处理程序代码
}
LRESULT CALLBACK JournalRecordProc(int nCode,WPARAM wparam,LPARAM lparam)
{
if (nCode<0)
return CallNextHookEx(NULL,nCode,wparam,lparam);
EVENTMSG*pmsg=(EVENTMSG*)lparam;
switch(nCode)
{
case HC_ACTION:
{EVENTMSG * pEventMsg =new EVENTMSG;
memcpy(pEventMsg,pmsg,sizeof(EVENTMSG));
EventMsgList.AddTail(pEventMsg);}
break;
case HC_SYSMODALOFF:
break;
case HC_SYSMODALON:
break;
}
}
1>e:\pjb\mfcapplication2\mfcapplication2\mfcapplication2dlg.cpp(194): error C2440: “类型转换”: 无法从“overloaded-function”转换为“HOOKPROC” 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询