How do I refresh a modeless Dialog in a loop? 
Author Message
 How do I refresh a modeless Dialog in a loop?

Hi, I'm a MFC newbie.
Recently I created a Dialog ( derived from CDialog) by using MSVC dialog
editor. This dialog contains only a static text control, a push button
(Cancel) and a progress bar (CProgressCtrl). I put a
CProgressCtrl.StepIt() in a loop to make the progress bar to be redrawn
by itself, but somehow the static text and the push button become
"invisible" after first loop.

I'll very appreciate any explaniation, help or sample (even better).
Thanks in advance.

-Po



Mon, 31 Jul 2000 03:00:00 GMT  
 How do I refresh a modeless Dialog in a loop?

Hi Po-Chih,

You need to allow other messages to be handled. This can be done by calling
the example routine after you have updated your progress bar. A delay of 10
will just do fine.

void CBarDlg::MessageLoop(DWORD Delay)
{
   MSG       Msg;
   DWORD     dwStart;
   TIMERINFO tInfo;

   tInfo.dwSize = sizeof(TIMERINFO);
   TimerCount(&tInfo);
   dwStart = tInfo.dwmsS{*filter*}art + Delay;
   while (tInfo.dwmsS{*filter*}art < dwStart) {
      if (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {
         TranslateMessage(&Msg);
         DispatchMessage(&Msg);
      }
      TimerCount(&tInfo);
   }

Quote:
}

> Hi, I'm a MFC newbie.
> Recently I created a Dialog ( derived from CDialog) by using MSVC dialog
> editor. This dialog contains only a static text control, a push button
> (Cancel) and a progress bar (CProgressCtrl). I put a
> CProgressCtrl.StepIt() in a loop to make the progress bar to be redrawn
> by itself, but somehow the static text and the push button become
> "invisible" after first loop.

> I'll very appreciate any explaniation, help or sample (even better).
> Thanks in advance.

> -Po

--
Rob Goudvis




Tue, 01 Aug 2000 03:00:00 GMT  
 How do I refresh a modeless Dialog in a loop?

Hi,
Your problem is that "windows" doesn't  handle the messages while processing
your loop.
Calling a function like below should solve your problem:
void MyYield()
{
    MSG         msg;
    if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    {
     TranslateMessage(&msg);// Translates virtual key codes
     DispatchMessage(&msg); // Dispatches message to window
    }

Quote:
}

> Hi, I'm a MFC newbie.
> Recently I created a Dialog ( derived from CDialog) by using MSVC dialog
> editor. This dialog contains only a static text control, a push button
> (Cancel) and a progress bar (CProgressCtrl). I put a
> CProgressCtrl.StepIt() in a loop to make the progress bar to be redrawn
> by itself, but somehow the static text and the push button become
> "invisible" after first loop.

> I'll very appreciate any explaniation, help or sample (even better).
> Thanks in advance.

> -Po

--
**************************
*  Balint Hegedues

*
*  Reality2 Ges.m.b.H
*  Mariahilferstr. 89/a
*  1060 Wien
*  + 43-1-585 29 28
*  Vienna, Austria
*  www.reality2.com
**************************


Sun, 19 Nov 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Forced Refresh of CEdit in Modeless Dialog

2. How to refresh/update modeless dialog box appearance..?

3. Problem to refresh modeless dialog

4. Refreshing Modeless dialogs, how?

5. Modeless dialog - what am I doing wrong?

6. Modeless dialog message loop?

7. Modeless dialog shall not be modeless !

8. Q: tabbing not possible in modeless propertysheet / modeless dialog

9. Modeless property sheet in a modeless dialog box

10. Refresh view in "for" loop

11. doing a loop with an array - Windows is hating my guts this week

12. Refresh one Dialog after pressing OK in an other dialog

 

 
Powered by phpBB® Forum Software