我在CMainDlg添加了一个按钮(ID:IDC_SHOW),自己新插入一个Dialog(ID:IDD_PRINCIPLE)。
请问,应该怎么做才能实现当我单击这个按钮,就会弹出我新建的对话框?
本人菜鸟,还请高手指点详细步骤!!!毕设中遇到的困难,拜托了!!!

解决方案 »

  1.   

    1.把新插入一个Dialog的生成一个类
    2.IDC_SHOW的消息函数中调用该类
      CDialog dlg;
      dlg.DoModal();
      

  2.   

    STARTUPINFO si;
    PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) );
    si.cb = sizeof(si);
    si.dwFlags |= STARTF_USESHOWWINDOW;
    si.wShowWindow = SW_SHOW;
    ZeroMemory( &pi, sizeof( pi ) ); char file[ 300 ] = "Explorer.exe ";
    strcat( file, "http://news.sina.com.cn" );
    if( !CreateProcess( NULL, // No module name (use command line). 
    file, // Command line. 
    NULL,             // Process handle not inheritable. 
    NULL,             // Thread handle not inheritable. 
    FALSE,            // Set handle inheritance to FALSE. 
    0,                // No creation flags. 
    NULL,             // Use parent's environment block. 
    NULL,             // Use parent's starting directory. 
    &si,              // Pointer to STARTUPINFO structure.
    &pi )             // Pointer to PROCESS_INFORMATION structure.

    {
    AfxMessageBox( "CreateProcess failed." );
    }
      

  3.   

    模态:Dialog dlg;
    dlg.Domodal()'
    非模态:Dialog *dlg=new Dialog;
    dlg->Create(IDD_PRINCIPLE,NULL);
    dlg->ShowWindow(SW_SHOW);