Hi Thierry,
I've been browsing some examples to use OleLoadPicture on desktops and found something.
For example, in the examples:
http://www.codeproject.com/bitmap/render.asp?print=true
http://www.codetools.com/bitmap/load_jp ... ource..asp
... and several extras, a global memory area is allocated using GlobalAlloc, locked, a bitmap is copied while it's locked, and it's then unlocked and used as a stream. From what I can observe the memory area is never freed.
So I checked PocketFrog and you also don't execute GlobalFree(). It seems that in all samples I find on the web, all use GlobalLock/Unlock etc, but none of them ever free the memory.
My questions are:
(1) Why is never GlobalFree executed?
(2) Not related, but interesting anyways.
If you call GetDC(NULL) to get the DC for the entire display (like the examples & PocketFrog do), is it not necessary to release it afterwards with ReleaseDC(NULL, hDC) like it is with all other DCs? I could not find anything on this in the help file as well.
If it is a coding error, and GlobalFree should indeed be called, then we probably have lots of applications out there with heavy memory leaks...
!Updated: I just saw on the codetools forum that it does indeed cause memory leaks to call GetDC(NULL) and never release it. So here's one anyways...
/Johan
I've been browsing some examples to use OleLoadPicture on desktops and found something.
For example, in the examples:
http://www.codeproject.com/bitmap/render.asp?print=true
http://www.codetools.com/bitmap/load_jp ... ource..asp
... and several extras, a global memory area is allocated using GlobalAlloc, locked, a bitmap is copied while it's locked, and it's then unlocked and used as a stream. From what I can observe the memory area is never freed.
So I checked PocketFrog and you also don't execute GlobalFree(). It seems that in all samples I find on the web, all use GlobalLock/Unlock etc, but none of them ever free the memory.
My questions are:
(1) Why is never GlobalFree executed?
(2) Not related, but interesting anyways.
If it is a coding error, and GlobalFree should indeed be called, then we probably have lots of applications out there with heavy memory leaks...
!Updated: I just saw on the codetools forum that it does indeed cause memory leaks to call GetDC(NULL) and never release it. So here's one anyways...
/Johan