Custom window acting as a child window to an MFC Dialog - Programmer

This is a discussion on Custom window acting as a child window to an MFC Dialog - Programmer ; I have created a plain window using CreateWindow and positioned it on top of an MFC dialog to look like its a part of it. The custom window needs fast graphics updating so I wanted it to be devoid of ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Custom window acting as a child window to an MFC Dialog

  1. Custom window acting as a child window to an MFC Dialog

    I have created a plain window using CreateWindow and positioned it on
    top of an MFC dialog to look like its a part of it. The custom window
    needs fast graphics updating so I wanted it to be devoid of the MFC
    messaging baggage. It uses it own WndProc to handle messages.

    Everything works fine and I have used SetWindPos() to put the custom
    window on top of the mfc dialog in the z order. I check for WM_MOVE
    events on the MFC dialog and use Bitblt() to refresh the custom window
    contents and then SetWindowPos to update the window the MFC dialogs
    new position.

    The problem happens when I click somewhere on the MFC dialog. The
    custom window vanishes , its nowehere to be seen. Then when I move the
    Dialog , the WM_MOVE event fires and the custom window comes to whre
    it was. I have tried to hook the mouse events on the dialog but its
    not working. the window sometimes shows after a click or remains
    invisible

    Is there anything required to be put in the Wndproc of the custom
    window to see if its not visible anymore. Also how do I take care of
    the situations when the MFC dialog is partially overlapped by other
    windows. Which event do I handle in the Wndproc to take care of the
    display.

    Many thanks in advance.


  2. Re: Custom window acting as a child window to an MFC Dialog

    sengupta.amit@gmail.com wrote:
    > I have created a plain window using CreateWindow and positioned it on
    > top of an MFC dialog to look like its a part of it. The custom window
    > needs fast graphics updating so I wanted it to be devoid of the MFC
    > messaging baggage. It uses it own WndProc to handle messages.
    >
    > Everything works fine and I have used SetWindPos() to put the custom
    > window on top of the mfc dialog in the z order. I check for WM_MOVE
    > events on the MFC dialog and use Bitblt() to refresh the custom window
    > contents and then SetWindowPos to update the window the MFC dialogs
    > new position.
    >
    > The problem happens when I click somewhere on the MFC dialog. The
    > custom window vanishes , its nowehere to be seen. Then when I move the
    > Dialog , the WM_MOVE event fires and the custom window comes to whre
    > it was. I have tried to hook the mouse events on the dialog but its
    > not working. the window sometimes shows after a click or remains
    > invisible
    >
    > Is there anything required to be put in the Wndproc of the custom
    > window to see if its not visible anymore. Also how do I take care of
    > the situations when the MFC dialog is partially overlapped by other
    > windows. Which event do I handle in the Wndproc to take care of the
    > display.
    >
    > Many thanks in advance.
    >

    You say this window is a "child" but does it actually have the WS_CHILD
    window style? It should it it is going to act as if it is part of the
    MFC dialog window.

    Does the window procedure handle WM_PAINT messages? Almost every window
    (unless it is never intended to be visible) must be prepared to repaint
    itself whenever it receives WM_PAINT messages.

    Norm


+ Reply to Thread