Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Here's a challenge...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00268299
Message ID:
00268515
Vues:
10
>>I am trying to populate an image list control dynamically (requires picture objects). I am trying to populate it only by knowing a file extension. Here is how I have tried going about doing so:
>>
>>1. Look in the registry under HKEY_CLASSES_ROOT for the key equal to the extension, and grab the default value for the key.
>>2. Again look in the registry under HKEY_CLASSES_ROOT for the key equal to the previous value that I found, and grab the default value for the DefaultIcon key under it. This gives me the file and resource identifier for the associated icon. For example, for the extension .prg, I retrieve "d:\program files\visual...\vfp6.exe,-102"
>>3. Next, I can use the ExtractIcon function in shell32.dll to return a handle to the specified icon, but I'm not sure if this does me any good. I am now stuck trying to go from a handle to an icon, to loading the icon into the image list control, which requires me to use a picture object. In other words, I need to translate an icon handle to a picture object???
>>
>>Does anyone have any suggestions, or any other possible ideas to go from a file extension to loading it's associated icon into an image list?
>
>Hi Doug,
>
>Unfortunately, VFP has no control that will take an icon handle and display it (or store it in an ImageList). AFAIK, the only way to do this is to call the API function DrawIcon(). I've done this myself, but maintaining the icon on the form is a PITA. Further, there's no way to indicate the size.

Hi George,

Thanks for the response, although I don't like the way this sounds. I thought of one other possibility. Do you, or anyone reading this, know of any ActiveX control that will allow me to supply an exe, dll, or ico file along with the resource id, and have it return a picture object that I can use in the image list?

Doug Stalter

"According to the proverb, the best things are the most difficult." -Plutarch
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform