Click here to Skip to main content
15,898,036 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Starting with C++ Pin
Hamid_RT14-May-07 22:18
Hamid_RT14-May-07 22:18 
QuestionHow do I add a bitmap to a MENU Pin
jannathali13-May-07 22:35
jannathali13-May-07 22:35 
AnswerRe: How do I add a bitmap to a MENU Pin
_AnsHUMAN_ 13-May-07 22:51
_AnsHUMAN_ 13-May-07 22:51 
AnswerRe: How do I add a bitmap to a MENU Pin
Avadhut_Computer14-May-07 1:29
Avadhut_Computer14-May-07 1:29 
GeneralRe: How do I add a bitmap to a MENU Pin
Hamid_RT14-May-07 6:23
Hamid_RT14-May-07 6:23 
AnswerRe: How do I add a bitmap to a MENU Pin
Hamid_RT14-May-07 6:23
Hamid_RT14-May-07 6:23 
QuestionThread and PostMessage and Pointer Pin
AkiraOne13-May-07 22:35
AkiraOne13-May-07 22:35 
AnswerRe: Thread and PostMessage and Pointer Pin
Arman S.14-May-07 0:05
Arman S.14-May-07 0:05 
This work fine, but the problem is......sometimes when I close the application I see memoryleaks,
I think that the problem is legacy to the fact that the PostMessage does not come received and the class remains allotted...but I not sure...


I guess you are right unless there are no other places where you do new/delete. To make yourself sure of what happening I advise you to put TRACEs inside CGeneralData's ctor and dtor, and observe them; they should have been called equally. Anyway, there is a synchronization gap in the way the two threads communicate. Another level of uncertainty is caused by PostMessage which simply enqueues the message which some time later it will have been processed [actually between this duration you close the app and the message will not've been processed; thus there'd be a leak].

Another issue is the looping inside ThreadPipe; this worker thread should exit when the UI thread exits. So use CEvent to inform to the worker thread from the UI one. See here[^] for more details. In this case, when you garrantee that the worker thread will get known about the fact app exits, it would be possible to overcome the memory leak by not posting but sending (using SendMessage). But this may harm the functional logic of the app. And I am pretty sure there is no obvious solution to this situation.
If you redesign it, you could omit the 'new' inside the worker thread and do it inside the ui one; just post a message and let the ui thread do the new/delete part.

--
=====
Arman

GeneralRe: Thread and PostMessage and Pointer Pin
AkiraOne14-May-07 1:52
AkiraOne14-May-07 1:52 
AnswerRe: Thread and PostMessage and Pointer Pin
JudyL_MD14-May-07 2:24
JudyL_MD14-May-07 2:24 
GeneralRe: Thread and PostMessage and Pointer Pin
AkiraOne14-May-07 3:37
AkiraOne14-May-07 3:37 
QuestionMCP in vc++ Pin
vikas198213-May-07 22:03
vikas198213-May-07 22:03 
AnswerRe: MCP in vc++ Pin
prasad_som13-May-07 22:43
prasad_som13-May-07 22:43 
JokeRe: MCP in vc++ Pin
Rajesh R Subramanian13-May-07 23:13
professionalRajesh R Subramanian13-May-07 23:13 
GeneralRe: MCP in vc++ Pin
prasad_som13-May-07 23:23
prasad_som13-May-07 23:23 
GeneralRe: MCP in vc++ [modified] Pin
vikas198213-May-07 23:37
vikas198213-May-07 23:37 
GeneralRe: MCP in vc++ Pin
prasad_som13-May-07 23:47
prasad_som13-May-07 23:47 
GeneralRe: MCP in vc++ Pin
vikas198214-May-07 0:01
vikas198214-May-07 0:01 
GeneralRe: MCP in vc++ Pin
vijay_aroli13-May-07 23:57
vijay_aroli13-May-07 23:57 
GeneralRe: MCP in vc++ Pin
Rajesh R Subramanian14-May-07 6:49
professionalRajesh R Subramanian14-May-07 6:49 
GeneralRe: MCP in vc++ Pin
Mark Salsbery14-May-07 6:53
Mark Salsbery14-May-07 6:53 
GeneralRe: MCP in vc++ Pin
Rajesh R Subramanian14-May-07 6:57
professionalRajesh R Subramanian14-May-07 6:57 
GeneralRe: MCP in vc++ Pin
vikas198214-May-07 8:00
vikas198214-May-07 8:00 
GeneralRe: MCP in vc++ Pin
Rajesh R Subramanian15-May-07 6:52
professionalRajesh R Subramanian15-May-07 6:52 
QuestionRe: MCP in vc++ Pin
David Crow14-May-07 3:06
David Crow14-May-07 3:06 

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.