?
Solved

Odd flicker problem

Posted on 2005-04-25
7
Medium Priority
?
832 Views
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);
      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);
}
0
Comment
Question by:lwinkenb
7 Comments
 
LVL 16

Expert Comment

by:nonubik
ID: 13856769
Try using MoveWindow instead of SetWindowPos.
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 13856878
MoveWindow gives me the same problem.
0
 
LVL 23

Expert Comment

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

~roshan
0
[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

 
LVL 5

Author Comment

by:lwinkenb
ID: 13859604
It's not a dialog, it's actually a child MDI window.  The client window already has the style WS_CLIPCHILDREN.
0
 
LVL 3

Accepted Solution

by:
Darrylsh earned 1200 total points
ID: 13861262
0
 
LVL 23

Assisted Solution

by:Roshan Davis
Roshan Davis earned 800 total points
ID: 13864514
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));

~roshan
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 13982531
I was able to get a working solution from the information from that link.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

621 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