tags:

views:

42

answers:

2

On writing to the display with:

::TextOutW( pDC->m_hDC, x, y, &Out, 1 );

It only shows on the screen after every 15 calls (15 characters). For debugging purposes only, I would like to see the new character on the display after each call. I have tried ::flushall() and a few other things but no change. TIA

+1  A: 

GDI function calls are accumulated and called in batches for performance reasons. You can call GdiFlush after the TextOut call to perform the drawing immediately. Alternatively, call GdiSetBatchLimit(1) before outputting the text to disable batching completely.

interjay
Nice answer. Beat me by 45 seconds... :-)
Jerry Coffin
Thank you much!They both do what I want.BTW, I tried setting other values in GdiSetBatchLimit(); and found that 15 seems to be the max. Higher values batch only 15 and lower values act as expected. The docs say a value of 0 sets the default.
Harvey
A: 

::flushall() is for iostreams, so it won't affect Windows screen output at all. I've never tried it, but based on the docs, I believe GDIFlush() might be what you want. You should also be able to use GDISetBatchLimit(1); to force each call to run immediately upon being called.

Jerry Coffin
Thank you much! They both do what I want. That should be:GdiSetBatchLimit(1); and GdiFlush();
Harvey