win32 load icon not from file, but from <something>

GHUM haraldarminmassa at gmail.com
Thu Aug 10 13:31:59 EDT 2006


I have found a "make a icon in traybar" skript, and it loads its Icon
from a file

hinst =  win32gui.GetModuleHandle(None)
iconPathName= "c:/myapp/myapp.ico"
icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE
hicon = win32gui.LoadImage(hinst, str(iconPathName),
win32con.IMAGE_ICON, 0, 0, icon_flags)

that works great.

But now I have to distribute that icon together with the application -
that is one file more to take track. I would like to load this image
from <something>
with something being a string / a cStringIO / something pickled

The obvious

cPickle.dumps(hicon) leads to nothing, cause it only gets the ID of the
hicon :(

Any ideas / recommendations / tipps?

Harald




More information about the Python-list mailing list