Odd flicker problem

Posted on 2005-04-25
Last Modified: 2013-12-03
I have a window with 3 controls on it.  A richedit control, an editbox control, and a listbox control.  None of these controls ever overlap at all.  

While resizing the window, the richedit control, and the listbox control flicker very badly, but the editbox control doesn't flicker at all.  If I remove the listbox control, then nothing flickers when I'm resizing the window.

If I put all 3 controls in the window, and make the listbox control exactly 50 units in height, then nothing flickers when I resize the window.  This is very odd to say the least.

Here is my function which gets called during the WM_SIZING and WM_SIZE messages:

void ResizeControls(HWND hwndChild, RECT *prect)
      HWND            hChildCtrl;
      RECT            *r = prect;
      int                  cx, cy;

      cy = r->bottom - r->top;
      cx = r->right - r->left;

      /* Get the handle to the listbox window, and set its new position */
      hChildCtrl = GetDlgItem(hwndChild,IDC_LIST);

      /* Get the handle to the rich edit window, and set its new position */
      hChildCtrl = GetDlgItem(hwndChild,IDC_RICHEDIT);

      /* Get the handle to the edit window, and set its new position */
      hChildCtrl = GetDlgItem(hwndChild,IDC_EDIT);
      SetWindowPos(hChildCtrl,hwndChild,5,cy - 65,cx-20,25,SWP_NOZORDER);
Question by:lwinkenb
    LVL 16

    Expert Comment

    Try using MoveWindow instead of SetWindowPos.
    LVL 5

    Author Comment

    MoveWindow gives me the same problem.
    LVL 23

    Expert Comment

    by:Roshan Davis
    in the dialog properties you can set ClipChildren... Or
    OnInitDialog of the Parent window put the code..
    ModifyStyle(0, WS_CLIPCHILDREN);

    LVL 5

    Author Comment

    It's not a dialog, it's actually a child MDI window.  The client window already has the style WS_CLIPCHILDREN.
    LVL 3

    Accepted Solution

    LVL 23

    Assisted Solution

    by:Roshan Davis
    in the OnInitialUpdate function of the child view put

          SetClassLong(m_hWnd, GCL_HBRBACKGROUND, (ULONG)GetStockObject(NULL_BRUSH));
          SetClassLong(m_oListCtrl.m_hWnd, GCL_HBRBACKGROUND, (ULONG)GetStockObject(NULL_BRUSH));

    LVL 5

    Author Comment

    I was able to get a working solution from the information from that link.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (, we saw how to put the Delete button back there where it belongs.  "Delete" is …
    A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now