HDC hdc;
HWND hwnd = GetSafeHwnd();
hdc = ::GetDC(hwnd);
BITMAPINFO *m_pBMI = new BITMAPINFO;//彩色图像信息头
m_pBMI->bmiHeader.biBitCount = 32;//颜色深度
m_pBMI->bmiHeader.biClrImportant = 0;
m_pBMI->bmiHeader.biClrUsed = 0;
m_pBMI->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_pBMI->bmiHeader.biWidth = info[0].Width;
m_pBMI->bmiHeader.biHeight = -(info[0].Heigth);
m_pBMI->bmiHeader.biPlanes = 1;
m_pBMI->bmiHeader.biCompression = BI_RGB;//不压缩
m_pBMI->bmiHeader.biSizeImage = info[0].Length;
m_pBMI->bmiHeader.biXPelsPerMeter =0;
m_pBMI->bmiHeader.biYPelsPerMeter =0;
//以上填充结构体都其实不重要..不是问题所在...
StretchDIBits(hdc,0,0,info[0].Width,info[0].Heigth,0,0,
info[0].Width,info[0].Heigth,ptr[0],m_pBMI,DIB_RGB_COLORS,SRCCOPY);
::ReleaseDC(m_hWnd,hdc);显示的代码就这么点,在基于对话框的程序中能正常显示,但在单文档程序中的VIEW类中的客户区却显示不出来,但是我试了可以在其中划线.....求高手指点!
HWND hwnd = GetSafeHwnd();
hdc = ::GetDC(hwnd);
BITMAPINFO *m_pBMI = new BITMAPINFO;//彩色图像信息头
m_pBMI->bmiHeader.biBitCount = 32;//颜色深度
m_pBMI->bmiHeader.biClrImportant = 0;
m_pBMI->bmiHeader.biClrUsed = 0;
m_pBMI->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_pBMI->bmiHeader.biWidth = info[0].Width;
m_pBMI->bmiHeader.biHeight = -(info[0].Heigth);
m_pBMI->bmiHeader.biPlanes = 1;
m_pBMI->bmiHeader.biCompression = BI_RGB;//不压缩
m_pBMI->bmiHeader.biSizeImage = info[0].Length;
m_pBMI->bmiHeader.biXPelsPerMeter =0;
m_pBMI->bmiHeader.biYPelsPerMeter =0;
//以上填充结构体都其实不重要..不是问题所在...
StretchDIBits(hdc,0,0,info[0].Width,info[0].Heigth,0,0,
info[0].Width,info[0].Heigth,ptr[0],m_pBMI,DIB_RGB_COLORS,SRCCOPY);
::ReleaseDC(m_hWnd,hdc);显示的代码就这么点,在基于对话框的程序中能正常显示,但在单文档程序中的VIEW类中的客户区却显示不出来,但是我试了可以在其中划线.....求高手指点!
解决方案 »
- 一个函数大家一般写多少行?
- 有没有高手做过VC下的邮件客户端,能否发给我参考下,急用
- matlab7.1与vc6混合编程发布的程序无法在其他未装MATLAB的机子上运行
- 不知道端口号能否建立socket连接?
- 大家好,问题多多,多多帮忙呀
- 为何会提示找不到_beginthread函数,急等
- 斑竹在干什么?为什么不封杀MaoZeDong2,老是在这里疯狂叫嚣。
- 怎样在一个线程里面调用一个函数?急啊!!!!
- 那位高手能讲一下size_t 是怎抹一回事,它是什莫,为什莫要定义他,还有ptrdiff_t
- 求解一个MFC串口的问题
- MFC 编程问题,滚动条滑块拖动后仍然回到最上端,
- 请问什么情况下BSTR包含的不是有效的UTF-16字符呢
{
// TODO: Add your command handler code here
MV_IMAGEINFO info;
unsigned char FileName[256];
PVOID ptr;
DWORD Num = MV_GetDeviceNumber(); MV_SetDeviceParameter(hDvcHdl[0],SET_GARBIMAGEINFO, (DWORD)&info );// 得到当前的图像的信息
ptr = MV_CaptureSingle(hDvcHdl[0], FALSE, NULL,0, &info);//采集一幅图像,返回RGB内存指针 HDC hdc;
HWND hwnd = GetSafeHwnd();
hdc = ::GetDC(hwnd);
BITMAPINFO *m_pBMI = new BITMAPINFO;//彩色图像信息头
m_pBMI->bmiHeader.biBitCount = 32;//颜色深度
m_pBMI->bmiHeader.biClrImportant = 0;
m_pBMI->bmiHeader.biClrUsed = 0;
m_pBMI->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_pBMI->bmiHeader.biWidth = info.Width;
m_pBMI->bmiHeader.biHeight = -(info.Heigth);
m_pBMI->bmiHeader.biPlanes = 1;
m_pBMI->bmiHeader.biCompression = BI_RGB;//不压缩
m_pBMI->bmiHeader.biSizeImage = info.Length;
m_pBMI->bmiHeader.biXPelsPerMeter =0;
m_pBMI->bmiHeader.biYPelsPerMeter =0;
StretchDIBits(hdc,0,0,768,576,0,0,
768,576,ptr,m_pBMI,DIB_RGB_COLORS,SRCCOPY);
::ReleaseDC(m_hWnd,hdc);
//以下为存图为BMP文件,可以正常将采集的图存储
CString filename,directory;
filename.Format("\\Card%d_%d",1, FileNUM);
directory=m_edit1;
directory+=filename;
strcpy((char*)&FileName[0],directory);
MV_SaveFile( FileName, BMP, ptr, &info, 1, FALSE, FALSE, 0 ); //将图片存位BMP格式
//AfxMessageBox("已采集单帧图像");}
但是我不知道为什么会错.