Click here to Skip to main content
15,877,637 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Timer in 10 Msec Pin
ThatsAlok20-Sep-07 23:11
ThatsAlok20-Sep-07 23:11 
Question[Solved] cleanup, DestroyWindow or OnDestroy? [modified] Pin
Hamed Musavi20-Sep-07 17:37
Hamed Musavi20-Sep-07 17:37 
AnswerRe: cleanup, DestroyWindow or OnDestroy? Pin
DevMentor.org20-Sep-07 18:12
DevMentor.org20-Sep-07 18:12 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
Hamed Musavi20-Sep-07 18:38
Hamed Musavi20-Sep-07 18:38 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
DevMentor.org20-Sep-07 19:06
DevMentor.org20-Sep-07 19:06 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
Hamed Musavi20-Sep-07 20:16
Hamed Musavi20-Sep-07 20:16 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
DevMentor.org20-Sep-07 20:32
DevMentor.org20-Sep-07 20:32 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
Hamed Musavi20-Sep-07 21:17
Hamed Musavi20-Sep-07 21:17 
Thank you very much for your help. Beacause of the first help you provided, I don't have any other question.

I was just thinking about how each function might make trouble.

In our scenario of course we terminate threads truly and use waiting mechanisms. The problem here is that if we stop threads in Cleanup function and call this function after main window is destroyed, and inside the thread (before cleanup is called) we try to access the window, the call will fail with an error because the main window already destroyed in DestroyWindow but cleanup has not been called yet. Before we call cleanup and attempt to stop thread, in OnDestroy, the thread might need to send a message to the already destroyed window.

This is a really rare situation, but I think I encountered a simmilar problem already and now found what was wrong.

I hope it is clearer now. I'm sorry English is not my native language and I, some times, encounter problems describing what I mean.

// "Life is very short and is very fragile also." Yanni
while (I'm_alive)
{
cout<<"I love programming.";
}

GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
DevMentor.org20-Sep-07 21:25
DevMentor.org20-Sep-07 21:25 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
Hamed Musavi20-Sep-07 22:33
Hamed Musavi20-Sep-07 22:33 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
DevMentor.org21-Sep-07 8:22
DevMentor.org21-Sep-07 8:22 
QuestionControlling other applications? Pin
Lord Kixdemp20-Sep-07 16:07
Lord Kixdemp20-Sep-07 16:07 
AnswerRe: Controlling other applications? Pin
Steve Echols20-Sep-07 16:51
Steve Echols20-Sep-07 16:51 
AnswerRe: Controlling other applications? Pin
nbugalia20-Sep-07 19:27
nbugalia20-Sep-07 19:27 
AnswerRe: Controlling other applications? Pin
ThatsAlok20-Sep-07 23:12
ThatsAlok20-Sep-07 23:12 
GeneralRe: Controlling other applications? Pin
Rajesh R Subramanian21-Sep-07 0:39
professionalRajesh R Subramanian21-Sep-07 0:39 
GeneralRe: Controlling other applications? Pin
ThatsAlok21-Sep-07 0:59
ThatsAlok21-Sep-07 0:59 
GeneralRe: Controlling other applications? Pin
Lord Kixdemp21-Sep-07 1:05
Lord Kixdemp21-Sep-07 1:05 
JokeOne More ?? Pin
ThatsAlok20-Sep-07 23:13
ThatsAlok20-Sep-07 23:13 
JokeRe: One More ?? Pin
Lord Kixdemp21-Sep-07 10:01
Lord Kixdemp21-Sep-07 10:01 
GeneralRe: One More ?? Pin
Mark Salsbery21-Sep-07 10:12
Mark Salsbery21-Sep-07 10:12 
GeneralRe: One More ?? Pin
Lord Kixdemp21-Sep-07 13:27
Lord Kixdemp21-Sep-07 13:27 
Questionkrunode Pin
youbo20-Sep-07 16:05
youbo20-Sep-07 16:05 
AnswerRe: krunode Pin
Lord Kixdemp20-Sep-07 16:10
Lord Kixdemp20-Sep-07 16:10 
QuestionRe: krunode Pin
David Crow20-Sep-07 17:22
David Crow20-Sep-07 17:22 

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.