Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > update CDialog region in a user defined message handler

Reply
Thread Tools

update CDialog region in a user defined message handler

 
 
k.sahici
Guest
Posts: n/a
 
      06-11-2010
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.
 
Reply With Quote
 
 
 
 
Jorgen Grahn
Guest
Posts: n/a
 
      06-11-2010
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 .
 
Reply With Quote
 
 
 
 
Paul Bibbings
Guest
Posts: n/a
 
      06-11-2010
Jorgen Grahn <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User-defined exception: "global name 'TestRunError' is not defined" jmike@alum.mit.edu Python 1 07-10-2008 12:37 PM
Can't use activex control inside Cdialog and thread vut.wong@gmail.com C++ 1 07-12-2007 03:10 AM
#if (defined(__STDC__) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) Oodini C Programming 1 09-27-2005 07:58 PM
How to create two CDialog windows active in MFC ? iceColdFire C++ 3 05-10-2005 04:20 AM
cdialog with no standard border Pagaia C++ 2 08-27-2004 08:20 AM



Advertisments