James, the following is my imageViewer class: IMPLEMENT_DYNAMIC(ImageViewer, CDialog) ImageViewer::ImageViewer(CWnd* pParent /*=NULL*/) : CDialog(ImageViewer::IDD, pParent) { } ImageViewer::~ImageViewer() { } void ImageViewer::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_CAM1_IMG, m_nCam1img); DDX_Control(pDX, IDOK, m_ok); DDX_Control(pDX, IDCANCEL, m_canc); } BEGIN_MESSAGE_MAP(ImageViewer, CDialog) END_MESSAGE_MAP() BOOL ImageViewer::OnInitDialog() { CDialog::OnInitDialog(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } // ImageViewer message handlers void ImageViewer::showPicture() { CPaintDC dc(this); // device context for painting HBITMAP bmpHandle = (HBITMAP)LoadImage(NULL, "cat.bmp",//strPictureName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION|LR_DEFAULTSIZE); //LR_LOADFROMFILE); CBitmap bmpPicture; CDC mdcPicture; CBitmap *bmpFromHandle = bmpPicture.FromHandle(bmpHandle); CRect rctPicture; m_nCam1img.GetWindowRect(&rctPicture); mdcPicture.CreateCompatibleDC(&dc); CBitmap * bmpPrevious = mdcPicture.SelectObject(bmpFromHandle); ScreenToClient(&rctPicture); dc.BitBlt(rctPicture.left, rctPicture.top, rctPicture.Width(), rctPicture.Height(), &mdcPicture, 0, 0, SRCCOPY); DeleteObject(bmpHandle); }
it doesn't have much. i open the dialog for this class before i call the showPicture() i also have break points right now... so any initialization should be complete by then... or am i just confused? thanks,
Kitty5