Click here to Skip to main content
15,914,780 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Timer in 10 Msec Pin
Roger Stoltz20-Sep-07 20:35
Roger Stoltz20-Sep-07 20:35 
AnswerRe: Timer in 10 Msec Pin
Randor 20-Sep-07 20:46
professional Randor 20-Sep-07 20:46 
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 
DevMentor.org wrote:
I have never has any issues with doing things in OnDestroy( )

I'm not sure. I think it would be safer to use DestroyWindow. As an example consider the following scenario:

I have a dialog class in which I create a worker thread and give a pointer to the dialog to that thread to post it's messages back to the dialog. I forget to use a safe message posting and write pWnd->PostMessage instead of ::PostMessage(pWnd->GetSafeHwnd(),... inside the thread.

I think here I'll have a problematic exit. The window is destroyed before the thread being stopped. So if the thread manages to send another message, the problem arise.


Please correct me if I'm wrong. Thank you so much in advanced.


// "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 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 
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 

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.