Click here to Skip to main content
16,005,697 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMemory leaks with malloc/realloc . . . Pin
madpuppy16-Sep-07 6:31
madpuppy16-Sep-07 6:31 
AnswerRe: Memory leaks with malloc/realloc . . . Pin
Mark Salsbery16-Sep-07 7:45
Mark Salsbery16-Sep-07 7:45 
GeneralRe: Memory leaks with malloc/realloc . . . Pin
DevMentor.org17-Sep-07 4:47
DevMentor.org17-Sep-07 4:47 
GeneralRe: Memory leaks with malloc/realloc . . . Pin
Mark Salsbery17-Sep-07 6:42
Mark Salsbery17-Sep-07 6:42 
Questionmessage-handler function for popup menu created at runtime Pin
blackbondi16-Sep-07 5:40
blackbondi16-Sep-07 5:40 
AnswerRe: message-handler function for popup menu created at runtime Pin
Abdellatif_El_Khlifi23-Sep-07 13:02
Abdellatif_El_Khlifi23-Sep-07 13:02 
QuestionCStatic usage of bitmaps... Pin
charlieg16-Sep-07 3:20
charlieg16-Sep-07 3:20 
AnswerRe: CStatic usage of bitmaps... Pin
Mark Salsbery16-Sep-07 7:57
Mark Salsbery16-Sep-07 7:57 
Generally if you set a bitmap at runtime, you would want to restore the
bitmap at runtime.

In this case, you should store the previous bitmap (returned by the first
CStatic::SetBitmap()/STM_SETIMAGE) and restore this when you're done with
the control.  This value may very well be NULL, but it's your responsibility to put
it back or track it's lifetime.

This is from the docs:
Important 
In version 6 of the Microsoft Win32 controls, a bitmap passed to a static control
using the STM_SETIMAGE message was the same bitmap returned by a subsequent
STM_SETIMAGE message. The client is responsible to delete any bitmap sent to a
static control.

With Microsoft Windows XP, if the bitmap passed in the STM_SETIMAGE message
contains pixels with non-zero alpha, the static control takes a copy of the bitmap.
This copied bitmap is returned by the next STM_SETIMAGE message. The client code
may independently track the bitmaps passed to the static control, but if it does not
check and release the bitmaps returned from STM_SETIMAGE messages, the bitmaps
are leaked.



Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: CStatic usage of bitmaps... Pin
charlieg16-Sep-07 9:28
charlieg16-Sep-07 9:28 
QuestionCan I construct CBitmap from heap Pin
m1m216-Sep-07 1:21
m1m216-Sep-07 1:21 
AnswerRe: Can I construct CBitmap from heap Pin
Mark Salsbery16-Sep-07 8:01
Mark Salsbery16-Sep-07 8:01 
GeneralRe: Can I construct CBitmap from heap Pin
m1m216-Sep-07 10:31
m1m216-Sep-07 10:31 
Questionundefined reference to `InitCommonControlsEx@4' ERROR Pin
$w0rdf1$h16-Sep-07 0:54
$w0rdf1$h16-Sep-07 0:54 
AnswerRe: undefined reference to `InitCommonControlsEx@4' ERROR Pin
$w0rdf1$h16-Sep-07 1:53
$w0rdf1$h16-Sep-07 1:53 
Questionunwanted exit of program Pin
Member 439909416-Sep-07 0:20
Member 439909416-Sep-07 0:20 
Questionhow can I clear overlay after using transparentblt Pin
gurucplusplus15-Sep-07 19:17
gurucplusplus15-Sep-07 19:17 
AnswerRe: how can I clear overlay after using transparentblt Pin
Mark Salsbery16-Sep-07 8:12
Mark Salsbery16-Sep-07 8:12 
GeneralRe: how can I clear overlay after using transparentblt Pin
gurucplusplus16-Sep-07 17:31
gurucplusplus16-Sep-07 17:31 
GeneralRe: how can I clear overlay after using transparentblt Pin
Mark Salsbery17-Sep-07 6:47
Mark Salsbery17-Sep-07 6:47 
GeneralRe: how can I clear overlay after using transparentblt Pin
gurucplusplus17-Sep-07 15:44
gurucplusplus17-Sep-07 15:44 
GeneralRe: how can I clear overlay after using transparentblt Pin
Mark Salsbery17-Sep-07 17:58
Mark Salsbery17-Sep-07 17:58 
GeneralRe: how can I clear overlay after using transparentblt Pin
gurucplusplus17-Sep-07 19:27
gurucplusplus17-Sep-07 19:27 
GeneralRe: how can I clear overlay after using transparentblt Pin
Mark Salsbery17-Sep-07 20:17
Mark Salsbery17-Sep-07 20:17 
GeneralRe: how can I clear overlay after using transparentblt Pin
gurucplusplus18-Sep-07 17:55
gurucplusplus18-Sep-07 17:55 
GeneralRe: how can I clear overlay after using transparentblt Pin
Mark Salsbery19-Sep-07 4:54
Mark Salsbery19-Sep-07 4:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.