title: GetDC() or CClientDC dc(this) does not work in non-message function?
body: <p>I'm trying to set background image in a MFC Dialog, I succeeded in getting the Client device context, while writing <code>CDC* pDC=GetDC()</code>, or <code>CClientDC dc(this)</code> , inside functions like <code>OnTimer</code>, <code>OnPaint</code>, <code>OnEraseBkgrd</code>, but not in a new declared function(also in <code>CDialog</code> class).</p>
  
  <p>I tested this by a simple drawing function, like drawing a rectangle in both case, the result is that, if I write it in <code>OnTimer</code>, <code>OnPaint</code>, <code>OnEraseBkgrd</code>, it works well, but in my declared new function it doesn't !</p>
  
  <p>Anyone can teach me how to get client dc in non-message functions?</p>