Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ExtractIcon or ExtractAssociatedIcon...
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00653833
Message ID:
00656866
Views:
25
>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.

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.

Alexander
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform