hello,

I want to close automatically my dialog box after I finish my process.
So In the idle function of my dialog, I check if my process is finished
and then send the WM_CLOSE message but this make crashed my
application.

however if I put a message box before
AfxGetMainWnd()->PostMessage(WM_CLOSE),
it works fine(well almost...)

here is my code :

LRESULT Fenetre::OnKickIdle(WPARAM, LPARAM lCount)
{
// Do processing similar to processing for the WM_IDLE message
LRESULT ret = 0;

if( ptr->IsFinish() )
{
MessageBox("OK","Success"); // works only with this
instruction
AfxGetMainWnd()->PostMessage(WM_CLOSE);
}

return ret;

}

nb : ptr is an ATL object

can someone please help me ?
thanks

yann