Re: Problem with GDI and Aero



The whole sequence is suspect. If you are drawing a bitmap inside a dialog box, you would
be doing it int he OnPaint handler, which means there is no reason to call GetDC. So what
is the purpose of GetDC? What is the purpose of ClientToScreen/ScreenToClient? Why in
the world are you doing GetDlgItem? If the bitmap is being drawn in a static control,
then the static control's WM_PAINT handler is where you should be doing the work; it makes
no sense to have the dialog draw into a child control. I'd suggest fixing the code so it
is in the correct place doing the correct thing before trying to figure out why Aero is
defeating it; I suspect the reason it doesn't work is that the code is flat-out wrong, and
Aero does not support having a parent do random drawing on the surface of a child control
(a paradigm so unnatural that Aero probably refuses to support it)

The correct code would be in the WM_PAINT handler for the child control in which you are
drawing, and would be
BeginPaint
LoadBitmap
GetObject
GetClientRect
CreateCompatibleDC
SelectObject
BitBlt
EndPaint

or, actually, choose a static control with the SS_BITMAP style and just do SetBitmap to it
and the default behavior is that it will draw itself!
joe

On Thu, 31 Jul 2008 11:29:20 +0200, "Erwan" <Erwan@xxxxxxxxxx> wrote:

I use the following api to display a bitmap inside a dialogbox:

GetDC
LoadBitmap
GetObject
GetDlgItem
GetClientRect
ClientToScreen
ScreenToClient
CreateCompatibleDC
SelectObject
BitBlt

Under Vista with Aero, the bitmap is not displayed. With Aero deactivated or
XP,
the bitmap is correctly displayed. Even with Aero, there is no api error.
I tried various values for BitBlt (SRCCOPY, etc...) without success.

Thanks for your help.

.



Relevant Pages

  • Re: Problem with GDI and Aero
    ... then the static control's WM_PAINT handler is where you should be doing ... no sense to have the dialog draw into a child control. ... out why Aero is ... or, actually, choose a static control with the SS_BITMAP style and just ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Problem with GDI and Aero
    ... be doing it int he OnPaint handler, which means there is no reason to call ... no sense to have the dialog draw into a child control. ... out why Aero is ... or, actually, choose a static control with the SS_BITMAP style and just do ...
    (microsoft.public.win32.programmer.gdi)
  • Re: bitmap on cbutton
    ... *In the OnInitDialog handler - rearrange the controls and so on before they even become ... Furthermore, this bitmap is a local variable to your function, whatever it ... So you are selecting an uninitialized bitmap into a useless DC. ... But you have a DC that is not associated with any known control, ...
    (microsoft.public.vc.mfc)
  • Re: bitmap on cbutton
    ... *In the OnInitDialog handler - rearrange the controls and so on before ... Furthermore, this bitmap is a local variable to your function, whatever ... So you are selecting an uninitialized bitmap into a useless DC. ... But you have a DC that is not associated with any known control, ...
    (microsoft.public.vc.mfc)
  • Re: using bitmap for dialog background
    ... I was trying to use the "OnCtlColor" message handler to ... And now I have found that the bitmap displays well, ... pastel colors, and the controls were placed at exact x,y coordinates. ... int Xpos; ...
    (microsoft.public.vc.mfc)

Loading