From: Joseph M. Newcomer on
Yep, that's why I suggested it. I think LockWindowUpdate has more semantics, which is what
you are seeing demonstrated. Probably "this behavior is by design"
joe
On Thu, 24 Feb 2005 20:15:29 GMT, "AliR" <AliR(a)newsgroup.nospam> wrote:

>Relax Joe, I am not demonstrating code edicts. It's just an example, in case
>someone at Microsoft wants to reproduce this bug and fix it.
>
>
>
>But you are right SetRedraw() does not have the same side-effect as
>LockWindowUpdate().
>
>
>
>AliR.
>
>"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message
>news:ii6s11hm1lpt0rvk4oa8u02uie8mpoeo1t(a)4ax.com...
>> You should probably not be using LockWindowUpdate, but using
>SetRedraw(FALSE) and
>> SetRedraw(TRUE);
>>
>> Use of #define is considered tasteful, instead of silly hardwired values
>like "100".
>> joe
>>
>> On Thu, 24 Feb 2005 16:10:24 GMT, "AliR" <AliR(a)newsgroup.nospam> wrote:
>>
>> >Hi Everyone,
>> >
>> >I have found an intersting bug, and I am not sure where to look for a
>> >solution. I have a form view with a list contrl that gets updated every 5
>> >seconds or so using a Timer. In the code that updates the List control I
>> >use LockWindowUpdate and UnlockWindowUpdate because the list control
>draws
>> >very slowly.
>> >Now if I minimize my application the desktop starts flashing!
>> >To recreate the problem, I used a Dialog application, added a List
>control,
>> >with the following code:
>> >
>> >BOOL CMyDlg::OnInitDialog()
>> >{
>> > CDialog::OnInitDialog();
>> > SetTimer(100,1000,NULL);
>> > return TRUE;
>> >}
>> >
>> >void CMyDialog::OnTimer(int nIDEvent)
>> >{
>> > if (nIDEvent == 100)
>> > {
>> > m_List.LockWindowUpdate();
>> > m_List.UnlockWindowUpdate();
>> > }
>> >}
>> >
>> >As soon a I minimize the dialog the desktop starts flashing. Has anyone
>run
>> >into this before?
>> >
>> >I have even tried it with an Edit control and the same thing happens.
>> >
>> >I am not sure if it is my computer or it is a bug!
>> >
>> >AliR.
>> >
>>
>> Joseph M. Newcomer [MVP]
>> email: newcomer(a)flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>

Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: David Ching on

"AliR" <AliR(a)newsgroup.nospam> wrote in message
news:qyqTd.40966$wi2.15199(a)newssvr11.news.prodigy.com...
> The IsIconic would fix this example. But the real code is in a CFormView
> in
> an MDI application. The view wouldn't know anything about the mainframe
> being minimized. I switched to WM_SETREDRAW, and things are fine.
> But I am just amazed that this bug even exists in the SDK.
>

FWIW, I've also experienced the same problem and tried to workaround it by
using IsIconic(). But SetRedraw() seems better. See
http://groups-beta.google.com/group/borland.public.delphi.nativeapi/browse_frm/thread/4b212ed3eb974c59/7b0cbb7a58e7a3c7?q=lockwindowsUpdate+SetRedraw&_done=%2Fgroups%3Fq%3DlockwindowsUpdate+SetRedraw%26hl%3Den%26lr%3D%26sa%3DN%26tab%3Dwg%26&_doneTitle=Back+to+Search&&d#7b0cbb7a58e7a3c7
for a discussion on the two techniques. It seems there isn't a universally
best answer.

-- David


From: Gary Chang[MSFT] on
Hi AliR,

Thanks for your concern on this problem, I will send this issue to our
corresponding product team to investigate.

By the way, I think CheckAbdoul's opinion would be the reason for that
desktop flashing behavior.


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ýýC www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.