win32ui screen capture

Me Mine
Fri Jun 27 01:15:51 EDT 2003


Hi again,

ok, so now I'm closer.  I can create a compatible memory dc and a new
bitmap, which is always black is created.  But I can't figure out how
to BitBlt to the memory DC from the window DC.  The line is commented
out below.  Also, depending on what wndow I select I get a windows
popup error titled python.exe Application error

The instruction at 0x77fcb836 referenced memory at 0xfffffff8.  The
memory could not be read.  click on OK to terminate the program



import win32gui
import win32ui
from wxPython.wx import *

numWindows = 0
windows = []
winDict = {}
windowsText=[]
inc = 0

def _MyCallback( hwnd, extra ):
	extra.append(hwnd)


win32gui.EnumWindows(_MyCallback, windows)
for i in windows:
	if win32gui.IsWindowVisible(i): 
		if win32gui.IsWindowVisible:
			windowsText.append(i)
			winDict[numWindows] = i
			numWindows +=1
					
	
	

print "Please select a window to capture"
for window in windowsText:
		windowText = win32gui.GetWindowText(window)
		print inc, windowText
		inc += 1

selection = input() 
print win32gui.GetWindowText(winDict[selection])
myHdc = win32gui.GetWindowDC(winDict[selection])
win32gui.SetForegroundWindow(winDict[selection])
win_sz = win32gui.GetClientRect(winDict[selection])
myDC = win32ui.CreateDC()
myMemDC = myDC.CreateCompatibleDC(myHdc)
#myMemDC.BitBlt((0,0), (win_sz[2], win_sz[3]), myHdc, (0,0), 204)
myBitMap = win32ui.CreateBitmap()
myBitMap.CreateCompatibleBitmap(myMemDC, win_sz[2], win_sz[3])
myBitMap.SaveBitmapFile(myMemDC, "c:\mybitmap.bmp")







----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---




More information about the Python-list mailing list