instructions
in your header file define a cwinthread-derived class... 
class cdialogthread : public cwinthread
{
 declare_dyncreate(cdialogthread)
 cdialogthread() {};
 virtual bool initinstance();
};
put this in your implementation file (where csomedialog is a conventional dialog class defined the usual way). 
implement_dyncreate(cdialogthread, cwinthread)
bool cdialogthread::initinstance() 

 csomedialog dlg;
 dlg.domodal();
 return false;

to create an instance of your (now-modeless) modal dialog, do this... 
afxbeginthread ( runtime_class(cdialogthread) );
you can end the dialog the normal way by calling cdialog::enddialog(), cdialog::oncancel() or cdialog::onok(). all those special caveats about modeless dialogs (like "don't call enddialog") no longer apply with this approach. 
one point to note is the return of 'false' from the initinstance() override. this tells mfc that the thread didn't start successfully, so mfc does our cleanup for us! note that by this time the dialog has already returned and we're through with the thread. this is the same thing mfc-generated code does in the initinstance() of dialog-based applications. 有一个教程是这样但我照着做没有成功,对第3步以下的没怎么看明白?