As an addendum to my previous post: I was able to successfully do screen capturing using win32gui + win32ui, [though I am still looking for a solution that works without win32ui].  The code goes something like:
 
   l, t, r, b = win32gui.GetWindowRect(hwnd)
   h, w = b-t, r-l
   hDC = win32gui.GetDC(hwnd)
   tmpDC = win32ui.CreateDCFromHandle(hDC)
   myDC = tmpDC.CreateCompatibleDC()
   myBitmap = win32ui.CreateBitmap()
   myBitmap.CreateCompatibleBitmap(tmpDC, w, h)
   myDC.SelectObject(myBitmap)
   myDC.BitBlt((0,0), (w,h), tmpDC, (0,0), win32con.SRCCOPY)
   myBitmap.Paint(newDC)
 
   # process bitmap
 
   # cleanup
 
In the C/C++ code snippets I've seen, the cleanup step usually involves ReleaseDC(hwnd, hDC), DeleteDC(myDC), and DeleteObject(myBitmap).  Are these steps automatically handled in Python by win32gui and win32ui?  If not, can someone post a snippet of cleanup code that works for this example?
 
Thanks!
Marcus


Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to