下面是MSDN中的代码EnterCriticalSection(&CGDIThread::m_csGDILock);
CBrush* oldbrush;oldbrush = m_dc.SelectObject(&m_brush);
m_dc.Ellipse(m_rectPosition);
m_dc.SelectObject(oldbrush);
GdiFlush();
LeaveCriticalSection(&CGDIThread::m_csGDILock);我想问为什么一定要加下面三句,我注释他们结果没什么变化
EnterCriticalSection(&CGDIThread::m_csGDILock);
GdiFlush();
LeaveCriticalSection(&CGDIThread::m_csGDILock);
CBrush* oldbrush;oldbrush = m_dc.SelectObject(&m_brush);
m_dc.Ellipse(m_rectPosition);
m_dc.SelectObject(oldbrush);
GdiFlush();
LeaveCriticalSection(&CGDIThread::m_csGDILock);我想问为什么一定要加下面三句,我注释他们结果没什么变化
EnterCriticalSection(&CGDIThread::m_csGDILock);
GdiFlush();
LeaveCriticalSection(&CGDIThread::m_csGDILock);
The GdiFlush function flushes the calling thread's current batch你要完成什么功能?要在具体过程中才能体现出来的
我認為GdiFlush的功能就是清空當前線程所擁有的內存空間 你如果不這樣 那你用多線程實現看看.