>I am tyring to display icons for any type of file, similar to the windows explorer. (I.E. - display the correct icon for a word document, the correct icon to represent an excel spreadsheet)
>
>My problem is in getting the associated icon of a file and putting it into the image list for the listview control.
>
>I need the correct syntax for the ExtractAssociatedIcon API call, code that can draw the picture from the handle that is returned by the API function and how to add the newly created object to the listview's imagelist.
>
>OR
>
>any other suggestions on how to do this?????
Hi Erin,
There are a couple of problems with trying to do this. They're not insurmontable, however. ExtractAssocatedIcon returns an icon handle (integer). You can't use a normal control, you have to use DrawIcon (in Shell32) to display it. In my article in the August, 1998 issue of FoxPro Advisor, I go through the details. In brief, here are the steps: 1. Get the window handle; 2. Get a device context; and 3. call DrawIcon, passing the device context the display coordinates, and the icon handle. Since you've referenced the imagelist control, however, I don't know if that's what you want to do.
George
Ubi caritas et amor, deus ibi est