|
-
Aug 6th, 2011, 07:45 PM
#4
Re: VB6 - Get Associated Sm/Lg Icon
 Originally Posted by LaVolpe
1. If you check the .Handle of the returned stdPicture object, if the .Handle and the SFI.hIcon are identical; shouldn't be destroying it. For bitmaps, OLE doesn't generally copy the image; it wraps a class around the handle. Not sure if icons are handled the same by OLE
You could be right, I'll check the values.
But:
SHGetFileInfo Function
Remarks
If SHGetFileInfo returns an icon handle in the hIcon member of the SHFILEINFO structure pointed to by psfi, you are responsible for freeing it with DestroyIcon when you no longer need it.
And:
OleCreatePictureIndirect Function
Remarks
The fOwn parameter indicates whether the picture is to own the GDI picture handle for the picture it contains, so that the picture object will destroy its picture when the object itself is destroyed. The function returns an interface pointer to the new picture object specified by the caller in the riid parameter. A QueryInterface is built into this call. The caller is responsible for calling Release through the interface pointer returned.
I'm calling with fOwn = True
Ok, tried it. Testing the 4 cases in the demo, the two handles have identical values each time. Yet everything works fine calling DestroyIcon on SFI.hIcon here.
I appreciate the input and I'll test the other issue, but I'm not sure about your suggestion not to destroy SFI.hIcon at this point.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|