Extract exe icon

hello, i want to extract an exe icon and display it as a bitmap :

···

---------------------------------------------------------------------------------------------------
import win32gui
import win32con
exefile = r'c:\file.exe'
iconHandle = win32gui.ExtractIcon(0,exefile,0)
icon = wx.EmptyIcon()
icon.SetHandle(iconHandle)
bmp = wx.BitmapFromIcon(icon)
wx.StaticBitmap(panel,bitmap=bmp,pos=(20,20))
---------------------------------------------------------------------------------------------------

but nothing appears on the panel, whats wrong? i printed iconHandle
and its a long int representing an icon handle,but what is missing?
thanks for your help....

Try something like this:

iloc = wx.IconLocation(exefile, 0)
icon = wx.IconFromLocation(iloc)
bmp = wx.BitmapFromIcon(icon)

···

On 7/2/10 11:25 AM, Personx wrote:

hello, i want to extract an exe icon and display it as a bitmap :

---------------------------------------------------------------------------------------------------
import win32gui
import win32con
exefile = r'c:\file.exe'
iconHandle = win32gui.ExtractIcon(0,exefile,0)
icon = wx.EmptyIcon()
icon.SetHandle(iconHandle)
bmp = wx.BitmapFromIcon(icon)
wx.StaticBitmap(panel,bitmap=bmp,pos=(20,20))
---------------------------------------------------------------------------------------------------

but nothing appears on the panel, whats wrong? i printed iconHandle
and its a long int representing an icon handle,but what is missing?
thanks for your help....

--
Robin Dunn
Software Craftsman

WoW, i have been struggling with this for an hour, thanks a lot it
works perfectly.D:)

I did something similar in this article:

You might find it helpful since it explains how to put an image in
your title bar too!

···

On Jul 2, 2:39 pm, Personx <muhannadshub...@gmail.com> wrote:

WoW, i have been struggling with this for an hour, thanks a lot it
works perfectly.D:)

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org