PreTranslateMessage question - Programmer

This is a discussion on PreTranslateMessage question - Programmer ; I have an MFC application which is based on a modal CDialog. It contains a Picture control which is resized if the parent dialog size changes - this keeps the picture control occupying the full width of the CDialog's client ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: PreTranslateMessage question

  1. PreTranslateMessage question

    I have an MFC application which is based on a modal CDialog. It
    contains a Picture control which is resized if the parent dialog size
    changes - this keeps the picture control occupying the full width of
    the CDialog's client area.

    The Picture Control is used to display video, but when the dialog box
    size is stretched it causes a lot of flickering because the Picture
    Control repeatedly redraws its background while also displaying the
    video.

    According to the documentation, I just have to trap WM_ERASEBKGND
    messages for the Picture Control to prevent it drawing its background.

    So I created a PreTranslateMessage function in my CMyDialog class, but
    surprisingly the only message belonging to the picture control that
    seems to go through this function is the occasional WM_PAINT.

    Spy++ seems to show that the Picture Control IS getting WM_ERASEBKGND
    messages, so it's a mystery why the parent dialog's
    PreTranslateMessage function does not see this message.

    Does anyone know what is wrong here? How can I trap the Picture
    Control's WM_ERASEBKGND message?

    Colin

  2. Re: PreTranslateMessage question

    "-" wrote in message
    news:611952a3.0311011337.6ed156a0@posting.google.c om...
    > I have an MFC application which is based on a modal CDialog. It
    > contains a Picture control which is resized if the parent dialog size
    > changes...
    > According to the documentation, I just have to trap WM_ERASEBKGND
    > messages for the Picture Control to prevent it drawing its background.
    > So I created a PreTranslateMessage function in my CMyDialog class, but
    > surprisingly the only message belonging to the picture control that
    > seems to go through this function is the occasional WM_PAINT.
    >
    > Spy++ seems to show that the Picture Control IS getting WM_ERASEBKGND
    > messages, so it's a mystery why the parent dialog's
    > PreTranslateMessage function does not see this message.


    I can't see why it should do. I think your best bet would be to subclass the
    static -- using the wizards, derive a class from CStatic, add a message-map
    handler for WM_ERASEBKGND to it, and bind it to a control member variable in
    the dialog class.
    --
    Jeff Partch [VC++ MVP]



+ Reply to Thread