Link to home
Start Free TrialLog in
Avatar of lwinkenb
lwinkenb

asked on

Odd flicker problem

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);
      SetWindowPos(hChildCtrl,hwndChild,r->right-r->left-140,5,120,r->bottom-r->top-75,SWP_NOZORDER);

      /* Get the handle to the rich edit window, and set its new position */
      hChildCtrl = GetDlgItem(hwndChild,IDC_RICHEDIT);
      SetWindowPos(hChildCtrl,hwndChild,0,0,cx-160,cy-75,SWP_NOZORDER|SWP_NOMOVE);

      /* 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);
}
Avatar of nonubik
nonubik

Try using MoveWindow instead of SetWindowPos.
Avatar of lwinkenb

ASKER

MoveWindow gives me the same problem.
in the dialog properties you can set ClipChildren... Or
OnInitDialog of the Parent window put the code..
ModifyStyle(0, WS_CLIPCHILDREN);

~roshan
It's not a dialog, it's actually a child MDI window.  The client window already has the style WS_CLIPCHILDREN.
ASKER CERTIFIED SOLUTION
Avatar of Darrylsh
Darrylsh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I was able to get a working solution from the information from that link.