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?
Doug Stalter
"According to the proverb, the best things are the most difficult." -Plutarch