EISEN Nicolas wrote: >> >> > I'm lucky, I found ... > > My Source : > > /from win32gui import * > import win32con > from pywintypes import HANDLE > import win32ui > listHicon = ExtractIconEx("c:\OpenOffice.exe",0) > tupleIcon = GetIconInfo (HANDLE ( listHicon[0][0] ) ) > > bitmapColor = tupel [4] > > picture = win32ui.CreateBitmap() > buffer = picture.GetBitmapBits ( bitmapColor ) > / > > Python return : > /win32ui.error: GetObject failed on bitmap/ > for the last line > > win32ui have CreateBitmap with 0 argument and GetBitmapBits with 1 > arguments > but win32gui have CreateBitmap with 5 arguments and GetBitmapBits have > 2 arguments
Yes. Can't you see why? win32gui is just a thin wrapper around the actual Win32 APIs. win32ui is an attempt to turn those APIs into something more like Python objects. Objects have access to additional state, so you don't have to specify as many parameters. When you call picture.GetBitmapBits( bitmapColor ) That's getting the pixels from the bitmap you just created. The parameter it takes is the number of bytes is should copy (so you're passing garbage). Your bitmap doesn't contain anything yet -- you haven't even set the size -- so naturally the GetBitmapBits call fails. You need to do EXACTLY what the demo does. Create a bitmap, set its size, then draw the icon on the bitmap, THEN pull the bits from the bitmap. The icon doesn't actually contain bitmaps. It contains arrays of pixels, but you need them to be a bitmap. > On the demo, hicon is use ton create the variable nid and re use it to > display on the screen, but i want get only the bitmap bits. I'm not sure why you think these two things are different. The way you get the bitmap bits is to draw the icon on a bitmap. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32