>>I thought of this. Allocate heap space for the picture, then destroy the heap. How about that?
>
>This not clear for me. Do you mean the OLE picture object or underlaying bitmap, icon etc? And may be this memory leak is not a problem at all? In any case memory will be released after closing of application.
I meant the OLE picture object. Further, I would assume that the memory would be automatically released. Perhaps, perhaps not. In all cases it's better to clean up and be sure than not.
One other thing I noticed. In checking the undocmented OleSavePictureFile(), I note that it takes a pointer to BSTR. In your code you emulate this using MultiByteToWideChar() to create a WCHAR. I, of course, am assuming that this seems to work. What comes to mind, however, is that a BSTR and a WCHAR aren't the same thing. While the portion of the BSTR (and this is for lurkers) representing the file name is indeed WCHAR, there is also a header portion to a BSTR that allows the string itself to be queried as to its length.
With all this in mind, did you try using an LPCSTR? The only reason I ask is that I'm trying to simlify the code as much as much as possible.
Thanks,
George
Ubi caritas et amor, deus ibi est