update CDialog region in a user defined message handler

Discussion in 'C++' started by k.sahici, Jun 11, 2010.

  1. k.sahici

    k.sahici Guest

    I found a library on CodeProject, named CPictureEx, to be able to load
    jpeg images in an MFC application. I created a control of type CStatic
    and then converted to this type(CPictureEx) to be able to associate
    this control to an image.

    I'm using this library in a dialog based project. No SDI/MDI.

    I have a user-defined message to update the region of this CPictureEx
    variable. When the main dialog receives my user-defined message it
    successfully updates the region and displays the jpeg file.

    However, it fails when it comes to unloading the jpeg file. I realized
    that WM_PAINT message has to be generated explicitly to be able to
    unload the image. Because when I minimized and then maximized this
    window, this jpeg file diappeared as I expected it to be.

    I have used various combinations of InvalidateRgn, UpdateWindow, etc.
    The only one that worked was "AfxGetMainWnd()->Invalidate();". As you
    might guess, this causes an annoying flickering.

    I guess this is a simple problem but unfortunately I'm not experienced
    with MFC.

    I'd be grateful if anyone could give me an idea to solve it.
     
    k.sahici, Jun 11, 2010
    #1
    1. Advertising

  2. k.sahici

    Jorgen Grahn Guest

    On Fri, 2010-06-11, k.sahici wrote:
    > I found a library on CodeProject, named CPictureEx, to be able to load
    > jpeg images in an MFC application. I created a control of type CStatic
    > and then converted to this type(CPictureEx) to be able to associate
    > this control to an image.
    >
    > I'm using this library in a dialog based project. No SDI/MDI.
    >
    > I have a user-defined message to update the region of this CPictureEx
    > variable. When the main dialog receives my user-defined message it
    > successfully updates the region and displays the jpeg file.
    >
    > However, it fails when it comes to unloading the jpeg file. I realized
    > that WM_PAINT message has to be generated explicitly to be able to
    > unload the image. Because when I minimized and then maximized this
    > window, this jpeg file diappeared as I expected it to be.
    >
    > I have used various combinations of InvalidateRgn, UpdateWindow, etc.
    > The only one that worked was "AfxGetMainWnd()->Invalidate();". As you
    > might guess, this causes an annoying flickering.
    >
    > I guess this is a simple problem but unfortunately I'm not experienced
    > with MFC.


    And neither are we. Try a MFC group.

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
     
    Jorgen Grahn, Jun 11, 2010
    #2
    1. Advertising

  3. Jorgen Grahn <> writes:

    > On Fri, 2010-06-11, k.sahici wrote:
    >> I guess this is a simple problem but unfortunately I'm not experienced
    >> with MFC.

    >
    > And neither are we. Try a MFC group.


    Try microsoft.public.vc.mfc

    Regards

    Paul Bibbings
     
    Paul Bibbings, Jun 11, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pagaia
    Replies:
    2
    Views:
    735
    Pagaia
    Aug 27, 2004
  2. iceColdFire
    Replies:
    3
    Views:
    565
    iceColdFire
    May 10, 2005
  3. Replies:
    1
    Views:
    375
    Alf P. Steinbach
    Jul 12, 2007
  4. SAL

    #Region #End Region issue

    SAL, Aug 29, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    363
    Alexey Smirnov
    Aug 29, 2008
  5. David Combs
    Replies:
    0
    Views:
    202
    David Combs
    Apr 4, 2006
Loading...

Share This Page