调用第三方dll,讯息循环报错
调用第三方dll,消息循环报错
if((*lpfnRegister)(hwnd,m_MsgID,Ip,25000,strSavePath.GetBuffer()))这句触发报错
------解决方案--------------------
HWND hwnd=AfxGetApp()->GetMainWnd()->GetSafeHwnd(); 有有没有值?
------解决方案--------------------
http://news.qq.com/a/20130705/005263.htm
函数中添加Log等
//存储注入模块Dll的路径全名
char szDllPath[1024]={0};
//生成注入模块DLL的路径全名
strcat(szDllPath,"E:\\NovaE\\Debug\\Bin\\Dll\\NovaPlutoManager.dll");
HMODULE hModule=LoadLibrary(szDllPath);
DWORD m_t=1000;
if (hModule)
{
//AfxMessageBox("NovaPlutoManager.dll loaded!");
}
else
{
m_t= GetLastError();
}
typedef bool (*LPFNREGISTER)(HWND, int, char*, int, char*);
LPFNREGISTER lpfnRegister = NULL;
lpfnRegister=(LPFNREGISTER)GetProcAddress(hModule,"NP_Initialize");
char Ip[]="192.168.1.110";
HWND hwnd=AfxGetApp()->GetMainWnd()->GetSafeHwnd();
CString strSavePath="E:\\CardInfo";
if (lpfnRegister)
{
if((*lpfnRegister)(hwnd,m_MsgID,Ip,25000,strSavePath.GetBuffer()))
{
AfxMessageBox("NP_Initialize ok");
}
else
{
AfxMessageBox("NP_Initialize Fail!");
}
}
}
BOOL CNovaEDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message==m_MsgID)
{
if(pMsg->wParam == WM_CARDINFO)
{
MessageBox("NP_Initialize发出的消息");
}
}
return CDialog::PreTranslateMessage(pMsg);
}
if((*lpfnRegister)(hwnd,m_MsgID,Ip,25000,strSavePath.GetBuffer()))这句触发报错
dll
消息循环
捕获dll消息
------解决方案--------------------
HWND hwnd=AfxGetApp()->GetMainWnd()->GetSafeHwnd(); 有有没有值?
------解决方案--------------------
http://news.qq.com/a/20130705/005263.htm
函数中添加Log等