this code uses windows api, but where do I find documentation about how to
use them?



import time
import ImageGrab # Part of PIL
from ctypes import *


#time.sleep(5)


# Load up the Win32 APIs we need to use.
class RECT(Structure):
    _fields_ = [
    ('left', c_ulong),
    ('top', c_ulong),
    ('right', c_ulong),
    ('bottom', c_ulong)
    ]


# time.sleep(2)

GetForegroundWindow = windll.user32.GetForegroundWindow
GetWindowRect = windll.user32.GetWindowRect

# Grab the foreground window's screen rectangle.
rect = RECT()
foreground_window = GetForegroundWindow()
GetWindowRect(foreground_window, byref(rect))
image = ImageGrab.grab((rect.left, rect.top, rect.right, rect.bottom))

# Save the screenshot as a BMP.
image.save("C:\projects\screenshot.bmp")
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to