//首先将窗体句柄传给线程参数
hWnd=GetSafeHwnd();
m_pThread=AfxBeginThread(ThreadAcquireData,hWnd);//启动线程//接下来我在线程中新建CDC对象
UINT ThreadAcquireData(LPVOID ThreadParam)
{//新线程,读取采集卡数据
CDC* pDC=GetDC((HWND)ThreadParam);
......
}但是提示错误:
error C2440: 'initializing' : cannot convert from 'struct HDC__ *' to 'class CDC *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast请各位英雄帮忙啊!!!!
hWnd=GetSafeHwnd();
m_pThread=AfxBeginThread(ThreadAcquireData,hWnd);//启动线程//接下来我在线程中新建CDC对象
UINT ThreadAcquireData(LPVOID ThreadParam)
{//新线程,读取采集卡数据
CDC* pDC=GetDC((HWND)ThreadParam);
......
}但是提示错误:
error C2440: 'initializing' : cannot convert from 'struct HDC__ *' to 'class CDC *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast请各位英雄帮忙啊!!!!
解决方案 »
- 如何判断一个Handle是一个HDC还是一个HFILE?
- VC6读取Orcale中Blob出错?通过OO40连接
- 个文件被拖拽到另一个文件夹中时,是不是通过SHChangeNotify函数来告诉系统?
- 求教一个老问题!怎样在程序中显示Word文档
- 有什么类是用来选择目录的呢?
- 各位大侠,这是一个关于串口读操作的问题,望能不啬赐教!
- 最近用VC写了一个要看图像的程序 问题多多 现在串口打开接收数据 整个程序会运行但 其余按钮什么的都用不了啊
- 对话框只刷新picture control,不刷新其他控件,怎么实现?
- COM组件 CreateInstance在MFC应用程序成功,在MFC ACTIVEX控件库中失败
- ★★★快来抢100分★★★:谁知道microsoft Forms 2.0 listbox中additem方法的使用?
- 急!CryptImportKey问题!!!
- CFileDilg 和 SHBrowseForFolder 的区别???
CDC *pDC;
pDC->Attach(hDC);
hWnd=GetSafeHwnd();
m_pThread=AfxBeginThread(ThreadAcquireData,hWnd);//启动线程 //接下来我在线程中新建CDC对象
UINT ThreadAcquireData(LPVOID ThreadParam)
{//新线程,读取采集卡数据
HDC pDC=GetDC((HWND)ThreadParam);
......
}
pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetWindowExt(CSize(20400,11720));
pDC->SetViewportExt(rectClient.right,-rectClient.bottom);
pDC->SetViewportOrg(rectClient.left,rectClient.bottom/2-80); //设置窗口左下角为原点坐标
......
CDC *pDC;
pDC->Attach(hDC);
告诉过你了,这样子写,GetDC函数还是你自己的哪个样子!
这个样子。
提示错误:
Unhandled exception in BioForcen.exe (MFC42D.DLL):0xC0000005: Access Violation