update CDialog region in a user defined message handler

K

k.sahici

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.
 
J

Jorgen Grahn

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top