From: Lewis Z. on
I have a MFC dialog based window application with an image as
background. Everytime Windows 7 changes screen resolution and the
image would be completely gone. I'm wondering what message I should
handle to avoid this. I have tried to search the forum and couldn't
find any relevant info.

Thank you.

Louis
From: David Ching on
"Lewis Z." <lzhou8(a)gmail.com> wrote in message
news:333097ae-8486-4d2d-8737-2ede4a359d05(a)r28g2000vbi.googlegroups.com...
> I have a MFC dialog based window application with an image as
> background. Everytime Windows 7 changes screen resolution and the
> image would be completely gone. I'm wondering what message I should
> handle to avoid this. I have tried to search the forum and couldn't
> find any relevant info.
>
> Thank you.
>

WM_DISPLAYCHANGE, you can handle it using ON_MESSAGE.

But it's puzzling why changing the resolution causes your image to
disappear.

-- David

From: Joseph M. Newcomer on
How are you drawing this image? You haven't said. I presume you are doing it in an
OnPaint handler of your derived dialog class. If you are not, that is what is wrong.

You would need to show the code.
joe

On Tue, 20 Apr 2010 12:09:33 -0700 (PDT), "Lewis Z." <lzhou8(a)gmail.com> wrote:

>I have a MFC dialog based window application with an image as
>background. Everytime Windows 7 changes screen resolution and the
>image would be completely gone. I'm wondering what message I should
>handle to avoid this. I have tried to search the forum and couldn't
>find any relevant info.
>
>Thank you.
>
>Louis
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Lewis Z. on
On Apr 20, 5:57 pm, "David Ching" <d...(a)remove-this.dcsoft.com> wrote:
> "Lewis Z." <lzh...(a)gmail.com> wrote in message
>
> news:333097ae-8486-4d2d-8737-2ede4a359d05(a)r28g2000vbi.googlegroups.com...
>
> > I have a MFC dialog based window application with an image as
> > background. Everytime Windows 7 changes screen resolution and the
> > image would be completely gone. I'm wondering what message I should
> > handle to avoid this. I have tried to search the forum and couldn't
> > find any relevant info.
>
> > Thank you.
>
> WM_DISPLAYCHANGE, you can handle it using ON_MESSAGE.
>
> But it's puzzling why changing the resolution causes your image to
> disappear.
>
> -- David

David, thanks for the reply. After I posted the msg, I did find out
WM_DISPLAYCHANGE with the help of the spy tool.
From: Lewis Z. on
Joe, thanks for the reply. I handled the drawing of the background
image in the EraseBackground msg handler. After I figured out the
WM_DISPLAYCHANGE, I called RedrawWindow in this msg handler. It didn't
help all the time. Sometimes I still saw the missing image.

I have basic OnPaint function, meaning it just calling
CDialog:OnPaint(). I commented out my OnPaint function. Now the
background image is diaplayed all the time whenever the display
setting is changed. But new problem shows up. Calling SetDlgItemText()
is causing problems. It shows some garbled texts unless screen is
refreshed. (I have a timer periodically displaying texts with null
brush to show transparent texts.)

Any suggestions?


On Apr 20, 8:33 pm, Joseph M. Newcomer <newco...(a)flounder.com> wrote:
> How are you drawing this image?  You haven't said.  I presume you are doing it in an
> OnPaint handler of your derived dialog class.  If you are not, that is what is wrong.
>
> You would need to show the code.
>                                 joe
>
> On Tue, 20 Apr 2010 12:09:33 -0700 (PDT), "Lewis Z." <lzh...(a)gmail.com> wrote:
> >I have a MFC dialog based window application with an image as
> >background. Everytime Windows 7 changes screen resolution and the
> >image would be completely gone. I'm wondering what message I should
> >handle to avoid this. I have tried to search the forum and couldn't
> >find any relevant info.
>
> >Thank you.
>
> >Louis
>
> Joseph M. Newcomer [MVP]
> email: newco...(a)flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm