SDI exe で,変換後のデータをそのまま開きたかった.
OnOpenDocument で開くことは可能だが,幾つかうまくない所がある.
CDocument の OnOpenDocument 前後の動作をデバッガで追いかけると,ビューの初期化が足りない.
CView* を求めて OnInitialUpdate で対応.
void CX__Doc::OnConvert()
{
if (GetPathName().IsEmpty()) { return ; }
tstring new_name ;
{
// ...
::G3_to_NEW(...,new_name.c_str()) ;
}
{
OnNewDocument () ;
OnOpenDocument(new_name.c_str()) ;
SetPathName (new_name.c_str()) ;
{
CFrameWnd* frame = (CFrameWnd*)AfxGetMainWnd() ;
if (frame != NULL) {
CView* view = frame->GetActiveView() ;
if (view != NULL) {
view->OnInitialUpdate() ;
}
}
}
}
}
