Hi K, I finally passed a MyView pointer to CDialog through constructor. Thus, I can access MyView member functions from CDialog. However, when I clicked OK on the Dialog, the program crashed. My guess is that I don't know how to delete the *pView that I passed to Dialog. I delete it in the contructor Dialog destructor). Any thought? By the way, it is a Modal dialog. Thanks,
jazzkiller
Posts
-
Access to its caller from a Dialog -
Access to its caller from a DialogThank you K, I finally passed a pointer of MyView to Dialog and access functions in MyView such as Invalidate and other member functions through this pointer. Thanks,
-
Access to its caller from a DialogDo I define WM_APP message in View and from Dialog I do: this->SendMessage(WM_DO_STUFF,0,0)? I did that, but it didn't work out. Thanks
-
Access to its caller from a DialogHi all, Inside a View class (CChildView), I call CDialog. The Dialog pops up. Now, how can I talk to the CChildView while the Dialog still shows? Say CChildView display a bitmap; in my dialog, I change the zoom parameter to 2x, I want the image to reflex the change immediately in the CChildView. Thank you in advance,
-
Image flickers when Invalidate() is called.This is all in my OnPaint() of a CChildView: CPaintDC dc(this); // device context for painting CDC* pDC = &dc; // Convert to context device pointer HDC hdc = pDC->GetSafeHdc(); // Prepare Header for image BITMAPINFO *m_pBitmapInfo; m_pBitmapInfo = (BITMAPINFO*)new char[sizeof(BITMAPINFO) + sizeof(RGBQUAD)*256]; // Load header m_pBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); m_pBitmapInfo->bmiHeader.biWidth = ImX; m_pBitmapInfo->bmiHeader.biHeight = -ImY; m_pBitmapInfo->bmiHeader.biPlanes = 1; m_pBitmapInfo->bmiHeader.biBitCount = 8; m_pBitmapInfo->bmiHeader.biCompression = BI_RGB; m_pBitmapInfo->bmiHeader.biSizeImage = 0; m_pBitmapInfo->bmiHeader.biXPelsPerMeter = 0; m_pBitmapInfo->bmiHeader.biYPelsPerMeter = 0; m_pBitmapInfo->bmiHeader.biClrUsed = 256; m_pBitmapInfo->bmiHeader.biClrImportant = 0; int i; for ( i = 0; i < 256; i++ ) { m_pBitmapInfo->bmiColors[i].rgbBlue = i; m_pBitmapInfo->bmiColors[i].rgbGreen = i; m_pBitmapInfo->bmiColors[i].rgbRed = i; m_pBitmapInfo->bmiColors[i].rgbReserved = 0; } // Stretch pixels out to screen StretchDIBits(hdc, xCord,yCord,ImX,ImY, 0,0,ImX,ImY, img, //------->>> Pointer to array of bits, a CChildView variable member. m_pBitmapInfo, DIB_RGB_COLORS, SRCCOPY);
-
Image flickers when Invalidate() is called.Hi, I have tried to override OnEraseBkgnd, the problem still occurs. I am writing and ViewLCD application for a camera (just like a digital camera with an LCD at the back to view the scene that the camera is pointing to). Thanks,
-
Image flickers when Invalidate() is called.Hi all, I was able to display an raw image (8bit per pixel) using StretchDIBits method. However, my OnPaint() is called alot so the image is flickering like crazy. How can I get rid of this flickering business. I've read tutorials on double buffering, however, I still don't understand how to apply it to this case where the image is from an array of bytes. Thanks,
-
Get out of infinite loop question!Hi all, I am writing a program that continuously stores data from an external memory. while(isConnected) { // Do stuff over here }// end while However, when it runs, it takes all the memory (program is not responded). I have another button (Stop) to call method to set isConnected to False in order to get out of the loop. However, I didn't even have a chance to hit that button because the program is freezed. Any suggestions? Thanks.
-
Display Raw Image on the flyHi all, I am capturing an image through a camera. The camera returns a pointer to a two dimensional array of pixels. How can I go about displaying these pixels into MFC? (Just like a webcam or a camera with an LCD does) I have read tutorials on displaying .bmp using CBitmap ... However, will MFC understands the raw image file (no header, each pixel has 8bit grayscale). I appreciate all of your help. Thanks, Beou