C# 调用C++ dll
运行后就提示:debug assertion failed
File:afxwin1.inl
Line:19
找到afxwin1.inl的19行内容是:
_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()
{
ASSERT(afxCurrentInstanceHandle != NULL);
return afxCurrentInstanceHandle;
}
请问这是什么问题,如何初始化实例,还是c#调用Csocket的问题,望高手帮忙,急!
C++:
extern "C" _declspec(dllexport) int InitVideoSDK(HWND pWnd)
{
int i;
SetTimer(pWnd, 1,1000,(TIMERPROC)TimerProc);//用回调函数处理
for(i=0; i<MAX_CAMERA_NUM; i++)
theApp.dvideo[i].CreateSocket(PORT_VIDEO,TYPE_VIDEO);
return 0;
}
C#:
[DllImport("lib_camera.dll")]
public static extern int InitVideoSDK(IntPtr pWnd);
private void button1_Click(object sender, EventArgs e)
{
try
{
InitVideoSDK(hwnd);
}
catch (System .Exception ex)
{
MessageBox.Show(ex.Message);
}
}