Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ExtractIcon or ExtractAssociatedIcon...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00653833
Message ID:
00656884
Vues:
26
>>Alexander,
>>
>>I've looked over your code and noted the memory leak problem. I'm interested in knowing how this will resolved. If I understand the documentation on OleCreatePictureIndirect() correctly, there is actually a pointer to an object returned. In order to resolve the problem, the object's Release method needs to be called.
>>
>>The other thing I've noticed is that you don't call DestroyIcon() to release the icon handles. This may cause a memory leak as well.
>
>Of course, in VFP6 no way to call Release() directly. So we need to find a function for releasing of object. I wanted to play with ReleaseStgMedium() and *pUnkForRelease member in STGMEDIUM structure. I found also a function (forgot it's name), which requires another interface, but calls Release() in all cases, even when a passed interface of wrong type. But I haven't tryed it so far.

Please keep me up-to-date on this.

>About DestroyIcon(). OleCreatePictureIndirect() is called with third parameter fOwn=1. This means that picture (Icon in this case) will be destroyed when the object is destroyed.
>

I understand that's what the docs say, but all three of the "ExtractIcon" functions specifically mention that you must call DestroyIcon() in order to destroy the icon. In this case, since OleCreatePictureIndirect() has no way of knowing the handle that references the picture (it isn't passed as a parameter), I'd at least err on the side of caution and use that function as well. I doubt if it would hurt anything.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform