1. RE: getHandle failed error code 495

> -----Original Message-----
> From: jacktarred at yahoo.com [mailto:jacktarred at yahoo.com]

> I have the following line in two programs:
> 
> constant stox = addIcon( extractIcon("mystox.ico"))
> 
> In one program I have no problems, in the other I get
> the message:
> 
>                error code 495
>                getHandle failed!
> 
> I tried throwing in the path for good measure but to
> no avail.  Anyone have a suggestion?

What exactly are you trying to do with the icon?  addIcon() is for adding
icons for listview/treeview/flattoolbars only.  Your usage suggests you're
adding an icon for a list/treeview.  You need to have created the control
before you can add icons for it.  If you look at the code for addIcon,
you'll see that it makes calls that add icons to ImageLists.  One of the
required parameters is the handle to the image list.  Win32Lib manages this
for you (assuming you've created a control that needs an ImageList).  If you
haven't created a list/treeview, then there is no handle, and getHandle will
bomb when asked for it. :)

extractIcon() is the right function for more general icon handling, but if
you're not using a list/treeview/flattoolbar, then you shouldn't call
addIcon().

Matt Lewis

new topic     » topic index » view message » categorize

2. RE: getHandle failed error code 495

jacktarred at yahoo.com wrote:
> I have the following line in two programs:
> 
> constant stox = addIcon( extractIcon("mystox.ico"))
> 
> In one program I have no problems, in the other I get
> the message:
> 
>                error code 495
>                getHandle failed!
> 
> I tried throwing in the path for good measure but to
> no avail.  Anyone have a suggestion?
> 
> Thanks,
> Jack
> 
Jack,
the addIcon routine adds icons to the image lists maintained within 
Win32lib. However, these lists are not created until the first create of 
a ListView, TreeView or ComboBoxEx control. So maybe the program is 
failing because the addIcon() is being called before the create() of one 
of these controls.

I will fix this the next version such that the image lists are created 
by addIcon() if not already done so.

--------
Derek.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu