menubar problem in eVC4.0
-
I use embedded visual c++ to write a video cam software, so that the pocket PC show the screen of the cam. But my menubar does not work.(I tick the top up box) When I click the top up button in menubar, the menubar hangs. But the screen still can show the video. void CGroup7Dlg::OnPreview() { unsigned char *pbuffer = (unsigned char *)malloc(m_PrvWidth * m_PrvHeight * 3); unsigned char *rpbuffer = (unsigned char *)malloc(m_PrvWidth * m_PrvHeight * 3); if ((PreviewFrame((unsigned char*) pbuffer)) == false) AfxMessageBox(_T("Preview Frame Fail!"), MB_OK); Rectify(pbuffer, rpbuffer); //<----- a CBitmap bitmap; bitmap.CreateBitmap(m_PrvWidth, m_PrvHeight, 1, 24, rpbuffer); CVOImage image; RECT pic_rect; m_picture_window.GetWindowRect(&pic_rect); HDC picDC = ::GetDC(m_picture_window.m_hWnd ); CString path_fname; ::WriteBitmapIntoJpegFile(TEXT("\\pic1.jpg"), 80, (HBITMAP)bitmap); UpdateData(true); path_fname ="\\My Documents\\pic1.jpg"; image.Load (picDC ,path_fname ); image.Draw (picDC ,2,13 ); free(pbuffer); pbuffer = NULL; free(rpbuffer); //<-------b rpbuffer = NULL; } There will be out of memory if I comment out line b but menubar works. There will be no problem but the screen pixel is in wrong order of course. I don't know how to fix this bug. Please help... :(