高手帮看错误在哪里?多谢多谢~~~
想把一副图像显示在一个picture控件里,在对话框中拉一个picture控件,定义其成员变量为,m_detect,然后获得其句柄。
HWND hWnd = m_detect.GetSafeHwnd();
HDC hdc=::GetDC(hWnd);
但是在这个地方总是显示错误,说error C2065: 'm_detect' : undeclared identifier。
这个m_detect应该是定义和初始化在testDlg.h和testDlg.cpp里,但是是在一个工程下的另外一个.cpp的函数里使用上述两句,会不会是这个地方有影响呢?附上此函数代码,向高手请教~~本人在做毕设,还是菜鸟级别~~
void CCaptureVideo::ImageProcessing(unsigned char*m_pDibBits, int m_height, int m_width)
{
HWND hWnd = m_detect.GetSafeHwnd();
HDC hdc=::GetDC(hWnd);
WidthA=640;
HeightA=480;
m_lpBmpInfoA=(LPBITMAPINFO)new char[WidthA*HeightA*3];
ZeroMemory(m_lpBmpInfoA,WidthA*HeightA*3);
m_lpBmpInfoA->bmiHeader.biSize=40;
m_lpBmpInfoA->bmiHeader.biPlanes=1;
m_lpBmpInfoA->bmiHeader.biBitCount=24;
m_lpBmpInfoA->bmiHeader.biWidth=WidthA;
m_lpBmpInfoA->bmiHeader.biHeight=HeightA;
m_lpBmpInfoA->bmiHeader.biSizeImage=WidthA*HeightA*3;
CRect rc0;//获取Static控件的大小范围
m_detect.GetClientRect(&rc0);
m_hDIB=DrawDibOpen();
if(m_hDIB!=NULL)
{
DrawDibBegin(m_hDIB,
hdc,
rc0.Width(), // don't stretch
rc0.Height(), // don't stretch
&m_lpBmpInfoA->bmiHeader,
WidthA, // width of image
HeightA, // height of image
0
);
DrawDibDraw(m_hDIB,
hdc,
rc0.left, // dest : left pos
rc0.top, // dest : top pos
rc0.Width(), // don't zoom x
rc0.Height(), // don't zoom y
&m_lpBmpInfoA->bmiHeader, // bmp header info
m_pDibBits, // bmp data
0, // src :left
0, // src :top
WidthA, // src : width
HeightA, // src : height
DDF_SAME_DRAW // use prev params....
);
}
delete[]m_lpBmpInfoA;m_lpBmpInfoA=NULL;
}