1>MFCApplication2Dlg.obj : error LNK2019: 無法解析的外部符號 "public: static long __stdcall CMFCApplication2Dlg::JournalRecordProc(int,unsigned int,long)" (?JournalRecordProc@CMFCApplication2Dlg@@SGJHIJ@Z),該符號在函數 "public: void __thiscall CMFCApplication2Dlg::OnBnClickedButton3(void)" (?OnBnClickedButton3@CMFCApplication2Dlg@@QAEXXZ) 中被引用
1>MFCApplication2Dlg.obj : error LNK2019: 無法解析的外部符號 "public: static long __stdcall CMFCApplication2Dlg::JounralPlaybackProc(int,unsigned int,long)" (?JounralPlaybackProc@CMFCApplication2Dlg@@SGJHIJ@Z),該符號在函數 "public: void __thiscall CMFCApplication2Dlg::OnBnClickedButton1(void)" (?OnBnClickedButton1@CMFCApplication2Dlg@@QAEXXZ) 中被引用
1>E:\PJB\MFCApplication2\Debug\MFCApplication2.exe : fatal error LNK1120: 2 個無法解析的外部命令
void CMFCApplication2Dlg::OnBnClickedButton3()
{
hHook =SetWindowsHookEx(
WH_JOURNALRECORD,
(HOOKPROC)JournalRecordProc,
AfxGetApp()->m_hInstance,
0
);
// TODO: 在此添加控件通知處理程序代碼
}
void CMFCApplication2Dlg::OnBnClickedButton1()
{
hHook=SetWindowsHookEx(
WH_JOURNALPLAYBACK,
(HOOKPROC)JounralPlaybackProc,
AfxGetApp()->m_hInstance,
0
);
// TODO: 在此添加控件通知處理程序代碼
}
static 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;
}
}
static LRESULT CALLBACK JournalPlaybackProc(int nCode,WPARAM wparam,LPARAM lparam)
{
static unsigned i=0;
static BOOL bFlag =TRUE;
EVENTMSG*pMsg;
POSITION pos;
DWORD PreTime,NowTime;
switch (nCode)
{
case HC_SKIP:
bFlag =TRUE;
i++;
break;
case HC_GETNEXT:
if(i>=EventMsgList.GetCount()-2)
{
i=0;
UnhookWindowsHookEx(hHook);
AfxMessageBox(_T("回放完畢!"));
}
pos=EventMsgList.FindIndex(i);
pMsg=EventMsgList.GetAt(pos);
memcpy((LPEVENTMSG)lparam,pMsg,sizeof(EVENTMSG));
if((i)!=0 && bFlag==TRUE)
{
bFlag=FALSE;
NowTime=pMsg->time;
pos=EventMsgList.FindIndex(i-1);
pMsg=EventMsgList.GetAt(pos);
PreTime=pMsg->time;
return NowTime-PreTime;
}
else return 0;
break;
default:
return CallNextHookEx(NULL,nCode,wparam,lparam);
}
return 0;
}
請問下哪有錯啊,很急
cpp中定義錯了修改下試試,把static刪了也
LRESULT CALLBACK CMFCApplication2Dlg::JournalRecordProc(int nCode,WPARAM wparam,LPARAM lparam)
LRESULT CALLBACK CMFCApplication2Dlg::JournalPlaybackProc(int nCode,WPARAM wparam,LPARAM lparam)