Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

update CDialog region in a user defined message handler

7 views
Skip to first unread message

k.sahici

unread,
Jun 11, 2010, 4:46:09 PM6/11/10
to
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.
0 new messages