Tim Roberts wrote:
EISEN Nicolas wrote:
Hi,

After search, I found many function to get Handler from exe (or dll)
file icons . But I don’t understand how use the Handler …

For example:

/>>> Import win32gui
i= win32gui.ExtractIcon(0,'e:\\dxdiag.exe',0)
icon = win32gui.LoadIcon ( i , 0)/
Or with ExtractIconEx to get a list of all icons, I’m always with many
Handlers without knowing how to save or write it in file.

The finality is to extract the exe file icon, and next, save the
picture on the disk.

Why do you want to do this?  Icons are intellectual property.  Unless
it's an open source app, you can't just scrape a bunch of icons from
existing applications and gather them into a library.  It's not legal.

Having said that, a few minutes with Google and MSDN would have answered
this question.  LoadIcon returns an HICON.  You can pass that to
GetIconInfo to return an ICONINFO structure, which includes the two
bitmaps that you need to draw an icon.  An icon always includes two
bitmaps: one is a monochrome bitmap that digs the hole for the color
image, and the other is the color image. Those are HBITMAP handles. You can then use GetBitmapBits to get the actual pixels.

It's possible this might be easier in C.

Thanks you

I understand I will use these functions, but my problem is to found how? I have difficulties to understand how use the arguments : I try some combinations and it's doesn't work.

Two big problems:

1 – When I read MSDN’s API for LoadIcon, How I designed which exe Files I will use ? The first argument is “handle to an instance of the module whose executable file contains the icon to be loaded”: How I can instantiate the handle, I didn’t found any constructor.

I think the second argument will be: win32con.|IDI_APPLICATION|

2 – My current script:

>>     import win32gui,win32con

    hicon = LoadIcon(0, win32con.IDI_APPLICATION)

    inconinfo =  GetIconInfo(hicon)

But my last problem is I didn’t found the python module for GetBitmapBits() function ...

Again, Thanks you for help me
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to