[python-win32] (no subject)

Jack Andrews effbiae at ivorykite.com
Fri Apr 22 06:55:38 CEST 2005


hi,  i can't seem to create a bitmap in memory using pywin32.  my assert
fails, telling me that the bitmap size is (0,0)?

here's fragments:

class window:
    def __init__
        ...
        self.hwnd = CreateWindow(...)
        wnd=CreateWindowFromHandle(self.hwnd)
        wdc=wnd.GetDC()
        dc=wdc.CreateCompatibleDC(wdc)
        (l,t,r,b)=wnd.GetWindowRect();h,w=b-t,r-l
        bm=CreateBitmap()
        bm.CreateCompatibleBitmap(dc,w,h)
        assert bm.GetSize()==(w,h),bm.GetSize()
        oldbm=dc.SelectObject(bm)
        br=CreateBrush(BS_SOLID,0xffffff,0)
        dc.FillRect((0,0,w,h),br)
        pen=CreatePen(PS_SOLID,0,0xeeee00)
        dc.SelectObject(pen)
        dc.Ellipse((0,0,w-20,h-20))
        bm.SaveBitmapFile(dc,"a.bmp")
        dc.SelectObject(oldbm)


thanks in advance,  jack


More information about the Python-win32 mailing list