Re: Text window not displaying inside loop

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



oops hit wrong key... sorry:

//
// Release main thread for background processing
//
void GiveTime()
{
// Idle until the screen redraws itself, et. al.
MSG msg;
while (::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) {
if (!AfxGetThread()->PumpMessage( )) {
::PostQuitMessage(0);
break;
}
}
// let MFC do its idle processing
LONG lIdle = 0;
while (AfxGetApp()->OnIdle(lIdle++ ))
;
}

So in your example you could do something like:

CString Output;
while (CountDown--) {
Output.Empty();

// extract figures and format into Output


m_DriveList.SetWindowText (Output); // display figures
GiveTime(); // Allow UI to update
}


Tom

"Lilith" <lilith@xxxxxxxxx> wrote in message news:q6va831t2ksp0o3ehdl643cggurail6cgn@xxxxxxxxxx
I have a utilty I'm in the process of writing for montoring the amount
of remaining space on a number of network drives. I'm adding
functionality to loop every X-seconds then checking the figures again.
Eventually these figures will be written to a file but for now I'm
trying to display them fresh on each loop to a text box.

CString Output;
while (CountDown--) {
Output.Empty();
.
. // extract figures and format into Output
.

m_DriveList.SetWindowText (Output); // display figures
Sleep (1000); // wait a second
}

In the current configuration this should accumulate the figures and
put them in Output. I can vouch that this is being done. My problem
is that the text window won't display until the while loop is
finished. Due to an earlier glitch, when I hadn't emptied Output at
the top of the loop, I could tell that the text was being placed in
the text box because I watched the vertical scroll bar react. But it
never displayed.

Is there something I need to do to force the display? Or is this
expected behavior?

--
TIA,
Lilith

.



Relevant Pages

  • Re: Text window not displaying inside loop
    ... // Idle until the screen redraws itself, ... MSG msg; ... functionality to loop every X-seconds then checking the figures again. ... trying to display them fresh on each loop to a text box. ...
    (microsoft.public.vc.mfc)
  • Re: wxPython: TextCtrl delayed update when using TE_RICH(2)
    ... wx.CallAfter mechanism to call gui functions in a threadsafe manner. ... The event loop is not yet finished when the program want to display something, potentially initiating a new event loop. ... If you don't want to bother with threads, the idle event approach is not so bad. ...
    (comp.lang.python)
  • Re: Concatination
    ... Use the msg box to display the RS count. ... Or alternatively put a breakpoint within the loop and make sure it gets ... This is just in case your recordset ...
    (microsoft.public.access.modulesdaovba)
  • Re: Why do CPUs run hotter...?
    ... chip makers started to make a real effort to make the chip go into a lower power state when this instruction is executed. ... A good description of what "HLT" should do is in the ACPI spec. ... Windows XP will use 'HLT' in its idle loop by default on an ACPI compliant system. ...
    (sci.electronics.design)
  • Re: Interpreting the colon operator
    ... I tried this by using the print statement inside the loop. ... What follows then would be a display of ... is apparently affected by the fact that matlab is aware that 'Av' ... three-dimensional matrix even though the first index is restricted ...
    (comp.soft-sys.matlab)