


# memcpy used to copy data from resource storage to our buffer pywin32 has no a lot of required functions And the finish step is save it to the file (I think you could translate it to PIL by yourself).ĬOMPLETE CODE TO READ LARGE RESOURCE: # Use wchar_t function version (FindResourceW rather than FindResourceA) The main goal here is to obtain pointer to the image resource real data and copy it to the Python buffer. So to read image from resources I've used the guide on C++. exe files that I have located in my PC I've find out that icons large than 32x32 or 16x16 pixels most probably represented by mean of. exe file (it's internals) but after I've analyze several. Of course I don't know what exactly your. Pywintypes.error: (0, 'CreateIconFromResource', 'No error message is available')Īfter some researches I've figured out that large icon stored not in ico format but in png (for my case). Once I've tried on file with large icon I've get the exception: Traceback (most recent call last): While file contains only 16x16 and 32x32 pixels icons everything will be Ok, here the output for Windows XP calculator: 1: 0x0093051B -> 32 32 Print("%2d: 0x%08X -> %d %d " % (icon_name, hicon, bminfo.bmWidth, bminfo.bmHeight)) Hicon = win32gui.CreateIconFromResource(rec, True) Rec = win32api.LoadResource(hlib, win32con.RT_ICON, icon_name) Icon_names = win32api.EnumResourceNames(hlib, win32con.RT_ICON) # This loop should print sizes of resources icons # LoadResource, FindResource and others will fail If you would like just see the result code (I hope it's exactly what you ask) you could find it after the "horizontal rule" below.įirst I tried to use the next code to determine what icon sizes stored in the resources of the file: # Using LoadLibrary (rather than CreateFile) is required otherwise I've made some researches and also post it.
