API: ExtractAssociatedIcon Error etc.

API: ExtractAssociatedIcon Error etc.

Post by Ali Eghteba » Wed, 09 Jun 1999 04:00:00



Hi all,

I'm using VB5 in Win95.
I've declared an API as below, and I get the error: "Can't find DLL entry
point
ExtractAssociateIconA in shell32.dll".
As far as I know this API is available in Win95.
I appreciate any help to fix this problem :-)
Something else that I've been wondering about is the last argument!
What value should I assign lpiIcon when calling this API?
Is there any alternative API that I could use to get the associated icon of
a file.

Declare Function ExtractAssociatedIcon Lib "shell32.dll" Alias
"ExtractAssociateIconA" (ByVal hInst As Long, ByVal lpIconPath As String,
lpiIcon As Long) As Long

--
Thanks in advance!
Ali Eghtebas

 
 
 

API: ExtractAssociatedIcon Error etc.

Post by Ali Eghteba » Wed, 09 Jun 1999 04:00:00


Ahh... I found it out. It seems that the Text API Viewer
spelled it wrong: "ExtractAssociateIconA" instead of
"ExtractAssociatedIconA".

But I still wonder:
What value should I assign lpiIcon when calling this API?
Perhaps 0&  ?
And something else, how do I get the icon in a i.e. ListView
through it's handle?

Thanx for any help
Ali Eghtebas

 
 
 

API: ExtractAssociatedIcon Error etc.

Post by Les Fergus » Thu, 17 Jun 1999 04:00:00




Quote:>Ahh... I found it out. It seems that the Text API Viewer
>spelled it wrong: "ExtractAssociateIconA" instead of
>"ExtractAssociatedIconA".

>But I still wonder:
>What value should I assign lpiIcon when calling this API?
>Perhaps 0&  ?

I think I recall using this a while ago.  Make lpiIcon =  -1  (I think
it was) and the function will return the number of icons in the file
(some exe's have more than one).  
Set lpiIcon to the index value of the icon you want to extract the
next time you call the function.  I could be wrong of course....

Quote:>And something else, how do I get the icon in a i.e. ListView
>through it's handle?

I will pass on that one  :-)
Quote:>Thanx for any help
>Ali Eghtebas

 
 
 

API: ExtractAssociatedIcon Error etc.

Post by Ali Eghteba » Thu, 17 Jun 1999 04:00:00


Thanx Les!



Quote:> >What value should I assign lpiIcon when calling this API?
> >Perhaps 0&  ?

> I think I recall using this a while ago.  Make lpiIcon =  -1  (I think
> it was) and the function will return the number of icons in the file
> (some exe's have more than one).  
> Set lpiIcon to the index value of the icon you want to extract the
> next time you call the function.  I could be wrong of course....

 
 
 

API: ExtractAssociatedIcon Error etc.

Post by Rene Whitwort » Thu, 17 Jun 1999 04:00:00


Hi Ali,



Quote:> Ahh... I found it out. It seems that the Text API Viewer
> spelled it wrong: "ExtractAssociateIconA" instead of
> "ExtractAssociatedIconA".

This is correct :-)

Quote:

> But I still wonder:
> What value should I assign lpiIcon when calling this API?
> Perhaps 0&  ?

See the other answer on this (Les is right)

Quote:> And something else, how do I get the icon in a i.e. ListView
> through it's handle?

You will have to use OLECreatePictureIndirect() to get it into an ImageList
control.
You can then use it like any other image in the ImageList.

Quote:

> Thanx for any help
> Ali Eghtebas

--
Hope this helps ...

Rene Whitworth
Whitworth Software Solutions - Germany
http://www.w-s-s.de
Please reply to the newsgroup :-)

 
 
 

API: ExtractAssociatedIcon Error etc.

Post by Ali Eghteba » Fri, 18 Jun 1999 04:00:00


Thanx alot Rene :-)

Regards
Ali Eghtebas



> Hi Ali,



> > Ahh... I found it out. It seems that the Text API Viewer
> > spelled it wrong: "ExtractAssociateIconA" instead of
> > "ExtractAssociatedIconA".

> This is correct :-)

> > But I still wonder:
> > What value should I assign lpiIcon when calling this API?
> > Perhaps 0&  ?

> See the other answer on this (Les is right)

> > And something else, how do I get the icon in a i.e. ListView
> > through it's handle?

> You will have to use OLECreatePictureIndirect() to get it into an
ImageList
> control.
> You can then use it like any other image in the ImageList.

 
 
 

API: ExtractAssociatedIcon Error etc.

Post by Ali Eghteba » Fri, 18 Jun 1999 04:00:00


Hi Rene,

Would you give me an example to how to pass
the hIcon to OLECreatePictureIndirect?

Regards
Ali Eghtebas



> Hi Ali,



> > Ahh... I found it out. It seems that the Text API Viewer
> > spelled it wrong: "ExtractAssociateIconA" instead of
> > "ExtractAssociatedIconA".

 
 
 

API: ExtractAssociatedIcon Error etc.

Post by Ali Eghteba » Fri, 18 Jun 1999 04:00:00


Never mind... I found how to do it :-)
It's very effective!

/Ali